summaryrefslogtreecommitdiffstats
path: root/Objects/setobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/setobject.c')
-rw-r--r--Objects/setobject.c3
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);
}