[Python-checkins] r55070 - in python/trunk: Include/pymem.h Modules/posixmodule.c

neal.norwitz python-checkins at python.org
Wed May 2 06:48:01 CEST 2007


Author: neal.norwitz
Date: Wed May  2 06:47:55 2007
New Revision: 55070

Modified:
   python/trunk/Include/pymem.h
   python/trunk/Modules/posixmodule.c
Log:
Stop using PyMem_FREE while the GIL is not held.  For details see:
http://mail.python.org/pipermail/python-dev/2007-May/072896.html


Modified: python/trunk/Include/pymem.h
==============================================================================
--- python/trunk/Include/pymem.h	(original)
+++ python/trunk/Include/pymem.h	Wed May  2 06:47:55 2007
@@ -30,6 +30,8 @@
    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.
 */
 
 /*

Modified: python/trunk/Modules/posixmodule.c
==============================================================================
--- python/trunk/Modules/posixmodule.c	(original)
+++ python/trunk/Modules/posixmodule.c	Wed May  2 06:47:55 2007
@@ -6296,8 +6296,8 @@
 #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);


More information about the Python-checkins mailing list