summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-09-30 12:54:39 (GMT)
committerGeorg Brandl <georg@python.org>2014-09-30 12:54:39 (GMT)
commit21bf3f942be920f3b051f6af43f7c37b9aa5cff3 (patch)
treeb3d710b9166372fc1a83fa5f4af87c1a55a75b42 /Modules
parenteaca8616ab0e219ebb5cf37d495f4bf336ec0f5e (diff)
downloadcpython-21bf3f942be920f3b051f6af43f7c37b9aa5cff3.zip
cpython-21bf3f942be920f3b051f6af43f7c37b9aa5cff3.tar.gz
cpython-21bf3f942be920f3b051f6af43f7c37b9aa5cff3.tar.bz2
Issue #22517: When a io.BufferedRWPair object is deallocated, clear its
weakrefs.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_io/bufferedio.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index a8278d4..f788e5c 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -2141,6 +2141,8 @@ static void
bufferedrwpair_dealloc(rwpair *self)
{
_PyObject_GC_UNTRACK(self);
+ if (self->weakreflist != NULL)
+ PyObject_ClearWeakRefs((PyObject *)self);
Py_CLEAR(self->reader);
Py_CLEAR(self->writer);
Py_CLEAR(self->dict);