Dropped GIL release around function calling PyMem_Malloc

Closes ticket #110.
This commit is contained in:
Daniele Varrazzo 2012-05-22 17:22:57 +01:00
parent ba1fe6fff6
commit 7982a6ac0b
2 changed files with 4 additions and 10 deletions

3
NEWS
View File

@ -4,6 +4,9 @@ What's new in psycopg 2.4.6
- Fixed 'cursor()' arguments propagation in connection subclasses
and overriding of the 'cursor_factory' argument. Thanks to
Corry Haines for the report and the initial patch (ticket #105).
- Dropped GIL release during string adaptation around a function call
invoking a Python API function, which could cause interpreter crash.
Thanks to Manu Cupcic for the report (ticket #110).
What's new in psycopg 2.4.5

View File

@ -73,16 +73,7 @@ qstring_quote(qstringObject *self)
/* encode the string into buffer */
Bytes_AsStringAndSize(str, &s, &len);
/* Call qstring_escape with the GIL released, then reacquire the GIL
before verifying that the results can fit into a Python string; raise
an exception if not. */
Py_BEGIN_ALLOW_THREADS
buffer = psycopg_escape_string(self->conn, s, len, NULL, &qlen);
Py_END_ALLOW_THREADS
if (buffer == NULL) {
if (!(buffer = psycopg_escape_string(self->conn, s, len, NULL, &qlen))) {
Py_DECREF(str);
PyErr_NoMemory();
return NULL;