bpo-31095: fix potential crash during GC (GH-2974)

This commit is contained in:
INADA Naoki 2017-08-24 14:55:17 +09:00 committed by GitHub
parent bf9075a0c5
commit a6296d34a4
14 changed files with 60 additions and 13 deletions

View file

@ -1084,6 +1084,8 @@ bytesiobuf_traverse(bytesiobuf *self, visitproc visit, void *arg)
static void
bytesiobuf_dealloc(bytesiobuf *self)
{
/* bpo-31095: UnTrack is needed before calling any callbacks */
PyObject_GC_UnTrack(self);
Py_CLEAR(self->source);
Py_TYPE(self)->tp_free(self);
}