[PyGreSQL] [CVS] Change to pygresql: pgmodule.c

Christoph Zwerschke cito at druid.net
Tue Sep 16 11:15:20 EDT 2008


Update of /usr/cvs/Public/pygresql/module
In directory druid.net:/tmp/cvs-serv6629

Modified Files:
	pgmodule.c 
Log Message:
Release the GIL while making a connection, as suggested by Peter Schuller.
To see the diffs for this commit:
   http://www.druid.net/pygresql/viewcvs.cgi/cvs/pygresql/module/pgmodule.c.diff?r1=1.76&r2=1.77

Index: pgmodule.c
===================================================================
RCS file: /usr/cvs/Public/pygresql/module/pgmodule.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- pgmodule.c	12 Oct 2007 12:20:00 -0000	1.76
+++ pgmodule.c	16 Sep 2008 15:15:20 -0000	1.77
@@ -1,5 +1,5 @@
 /*
- * $Id: pgmodule.c,v 1.76 2007/10/12 12:20:00 darcy Exp $
+ * $Id: pgmodule.c,v 1.77 2008/09/16 15:15:20 cito Exp $
  * PyGres, version 2.2 A Python interface for PostgreSQL database. Written by
  * D'Arcy J.M. Cain, (darcy at druid.net).  Based heavily on code written by
  * Pascal Andre, andre at chimay.via.ecp.fr. Copyright (c) 1995, Pascal Andre
@@ -1611,12 +1611,12 @@
 	{
 		memset(port_buffer, 0, sizeof(port_buffer));
 		sprintf(port_buffer, "%d", pgport);
-		npgobj->cnx = PQsetdbLogin(pghost, port_buffer,
-			pgopt, pgtty, pgdbname, pguser, pgpasswd);
 	}
-	else
-		npgobj->cnx = PQsetdbLogin(pghost, NULL,
-			pgopt, pgtty, pgdbname, pguser, pgpasswd);
+
+	Py_BEGIN_ALLOW_THREADS
+	npgobj->cnx = PQsetdbLogin(pghost, pgport == -1 ? NULL : port_buffer,
+		pgopt, pgtty, pgdbname, pguser, pgpasswd);
+	Py_END_ALLOW_THREADS
 
 	if (PQstatus(npgobj->cnx) == CONNECTION_BAD)
 	{



More information about the PyGreSQL mailing list