diff options
| -rw-r--r-- | Misc/NEWS | 3 | ||||
| -rw-r--r-- | Modules/_io/bufferedio.c | 2 |
2 files changed, 5 insertions, 0 deletions
@@ -24,6 +24,9 @@ Core and Builtins 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 #8471: In doctest, properly reset the output stream to an empty string when Unicode was previously output. diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c index feee9be..9a14d26 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -636,6 +636,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"); |
