summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-09-30 02:46:57 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-09-30 02:46:57 (GMT)
commitbbd0a323aeb1222d216fa10a9e1d9c91945ad1e6 (patch)
treec2acd0daf41ca6a3c27eae19a6a50515d2d1a37c /Modules
parentd48bc9468f75e57249da5e3518c42d4c8b83ba29 (diff)
downloadcpython-bbd0a323aeb1222d216fa10a9e1d9c91945ad1e6.zip
cpython-bbd0a323aeb1222d216fa10a9e1d9c91945ad1e6.tar.gz
cpython-bbd0a323aeb1222d216fa10a9e1d9c91945ad1e6.tar.bz2
clear BufferedRWPair weakrefs on deallocation (closes #22517)
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 c28e289..ea0302b 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -2254,6 +2254,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);