* psycopg/pqpath.c (_pq_fetch_tuples): Don't call Python APIs

without holding the GIL.
This commit is contained in:
James Henstridge 2008-03-06 15:12:40 +00:00
parent 14135c1d7e
commit e55e2683cf
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2008-03-07 James Henstridge <james@jamesh.id.au>
* psycopg/pqpath.c (_pq_fetch_tuples): Don't call Python APIs
without holding the GIL.
2008-02-27 James Henstridge <james@jamesh.id.au>
* NEWS: add some draft NEWS items for a 2.0.7 release.

View File

@ -688,12 +688,13 @@ _pq_fetch_tuples(cursorObject *curs)
int fsize = PQfsize(curs->pgres, i);
int fmod = PQfmod(curs->pgres, i);
PyObject *dtitem = PyTuple_New(7);
PyObject *type = PyInt_FromLong(ftype);
PyObject *dtitem;
PyObject *type;
PyObject *cast = NULL;
Py_BLOCK_THREADS;
dtitem = PyTuple_New(7);
PyTuple_SET_ITEM(curs->description, i, dtitem);
/* fill the right cast function by accessing three different dictionaries:
@ -702,6 +703,7 @@ _pq_fetch_tuples(cursorObject *curs)
- the global dictionary (at module level)
if we get no defined cast use the default one */
type = PyInt_FromLong(ftype);
Dprintf("_pq_fetch_tuples: looking for cast %d:", ftype);
if (curs->string_types != NULL && curs->string_types != Py_None) {
cast = PyDict_GetItem(curs->string_types, type);