diff options
author | INADA Naoki <methane@users.noreply.github.com> | 2017-08-24 05:55:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-24 05:55:17 (GMT) |
commit | a6296d34a478b4f697ea9db798146195075d496c (patch) | |
tree | 6a26d56297f7d85dd6a8f18bca96e0c4ffb60802 /Objects/setobject.c | |
parent | bf9075a0c55186d2f34df63e6c8512dd6414ff4b (diff) | |
download | cpython-a6296d34a478b4f697ea9db798146195075d496c.zip cpython-a6296d34a478b4f697ea9db798146195075d496c.tar.gz cpython-a6296d34a478b4f697ea9db798146195075d496c.tar.bz2 |
bpo-31095: fix potential crash during GC (GH-2974)
Diffstat (limited to 'Objects/setobject.c')
-rw-r--r-- | Objects/setobject.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c index 2347b9d..5c61bc7 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -553,6 +553,7 @@ set_dealloc(PySetObject *so) setentry *entry; Py_ssize_t used = so->used; + /* bpo-31095: UnTrack is needed before calling any callbacks */ PyObject_GC_UnTrack(so); Py_TRASHCAN_SAFE_BEGIN(so) if (so->weakreflist != NULL) @@ -809,6 +810,8 @@ typedef struct { static void setiter_dealloc(setiterobject *si) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ + _PyObject_GC_UNTRACK(si); Py_XDECREF(si->si_set); PyObject_GC_Del(si); } |