mirror of
https://github.com/python/cpython.git
synced 2025-08-24 10:45:53 +00:00
bpo-31095: fix potential crash during GC (GH-2974)
This commit is contained in:
parent
bf9075a0c5
commit
a6296d34a4
14 changed files with 60 additions and 13 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue