[Python-checkins] r83411 - in python/branches/py3k: Misc/NEWS Modules/_io/bufferedio.c

antoine.pitrou python-checkins at python.org
Sun Aug 1 18:53:42 CEST 2010


Author: antoine.pitrou
Date: Sun Aug  1 18:53:42 2010
New Revision: 83411

Log:
Issue #9448: Fix a leak of OS resources (mutexes or semaphores) when
re-initializing a buffered IO object by calling its `__init__` method.



Modified:
   python/branches/py3k/Misc/NEWS
   python/branches/py3k/Modules/_io/bufferedio.c

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Sun Aug  1 18:53:42 2010
@@ -29,6 +29,9 @@
 Library
 -------
 
+- Issue #9448: Fix a leak of OS resources (mutexes or semaphores) when
+  re-initializing a buffered IO object by calling its ``__init__`` method.
+
 - Issue #1713: Fix os.path.ismount(), which returned true for symbolic links
   across devices.
 

Modified: python/branches/py3k/Modules/_io/bufferedio.c
==============================================================================
--- python/branches/py3k/Modules/_io/bufferedio.c	(original)
+++ python/branches/py3k/Modules/_io/bufferedio.c	Sun Aug  1 18:53:42 2010
@@ -636,6 +636,8 @@
         return -1;
     }
 #ifdef WITH_THREAD
+    if (self->lock)
+        PyThread_free_lock(self->lock);
     self->lock = PyThread_allocate_lock();
     if (self->lock == NULL) {
         PyErr_SetString(PyExc_RuntimeError, "can't allocate read lock");


More information about the Python-checkins mailing list