]> granicus.if.org Git - python/commitdiff
Stop using PyMem_FREE while the GIL is not held. For details see:
authorNeal Norwitz <nnorwitz@gmail.com>
Wed, 2 May 2007 04:47:55 +0000 (04:47 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Wed, 2 May 2007 04:47:55 +0000 (04:47 +0000)
http://mail.python.org/pipermail/python-dev/2007-May/072896.html

Include/pymem.h
Modules/posixmodule.c

index 671f967c8913b6ccbc90351abe63daf431c42ad8..7f74f3701b0a78fd39720077ec983e3c2d039780 100644 (file)
@@ -30,6 +30,8 @@ extern "C" {
    debugging info to dynamic memory blocks.  The system routines have no idea
    what to do with that stuff, and the Python wrappers have no idea what to do
    with raw blocks obtained directly by the system routines then.
+
+   The GIL must be held when using these APIs.
 */
 
 /*
index 29ef1dcc99e8842fcb13815082c5e511916c2750..a63a77a3d5a81186b0e108ef047724414458024a 100644 (file)
@@ -6296,8 +6296,8 @@ posix_fdopen(PyObject *self, PyObject *args)
 #else
        fp = fdopen(fd, mode);
 #endif
-       PyMem_FREE(mode);
        Py_END_ALLOW_THREADS
+       PyMem_FREE(mode);
        if (fp == NULL)
                return posix_error();
        f = PyFile_FromFile(fp, "<fdopen>", orgmode, fclose);