]> granicus.if.org Git - python/commitdiff
Merged revisions 83411 via svnmerge from
authorAntoine Pitrou <solipsis@pitrou.net>
Sun, 1 Aug 2010 16:57:42 +0000 (16:57 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Sun, 1 Aug 2010 16:57:42 +0000 (16:57 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r83411 | antoine.pitrou | 2010-08-01 18:53:42 +0200 (dim., 01 août 2010) | 4 lines

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

Misc/NEWS
Modules/_io/bufferedio.c

index 7cf087b3f73a6819298c12159a7531cfd23b21df..6e52ecb10472c0e7d6d3e6ec7f6c3733a834ceda 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -84,6 +84,9 @@ C-API
 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 #8620: when a Cmd is fed input that reaches EOF without a final
   newline, it no longer truncates the last character of the last command line.
 
index b21ea718130e12cc20ace0f3119c2c8048a06d7e..c0c3acc5ebc4def318f8e8602c0d11d764301aa5 100644 (file)
@@ -632,6 +632,8 @@ _buffered_init(buffered *self)
         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");