clear BufferedRWPair weakrefs on deallocation (closes #22517)

This commit is contained in:
Benjamin Peterson 2014-09-29 22:46:57 -04:00
parent d48bc9468f
commit bbd0a323ae
3 changed files with 11 additions and 0 deletions

View file

@ -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);