summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/_io/bufferedio.c2
2 files changed, 5 insertions, 0 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 7cf087b..6e52ecb 100644
--- 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.
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index b21ea71..c0c3acc 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -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");