diff options
author | Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> | 2024-11-19 11:25:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-19 11:25:09 +0200 |
commit | 899fdb213db6c5881c5f9c6760ead6fd713d2070 (patch) | |
tree | c4e291504c73e8055d02176551beeb39ab47e6ad /Python/bytecodes.c | |
parent | 84f07c3a4cbcfe488ccfb4030571be0bc4de7e45 (diff) | |
download | cpython-899fdb213db6c5881c5f9c6760ead6fd713d2070.tar.gz cpython-899fdb213db6c5881c5f9c6760ead6fd713d2070.zip |
Revert "GH-126491: GC: Mark objects reachable from roots before doing cycle collection (GH-126502)" (#126983)
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r-- | Python/bytecodes.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 4479bd5dc56..c85b49842da 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -2340,6 +2340,10 @@ dummy_func( DEOPT_IF(ep->me_key != name); PyObject *old_value = ep->me_value; DEOPT_IF(old_value == NULL); + /* Ensure dict is GC tracked if it needs to be */ + if (!_PyObject_GC_IS_TRACKED(dict) && _PyObject_GC_MAY_BE_TRACKED(PyStackRef_AsPyObjectBorrow(value))) { + _PyObject_GC_TRACK(dict); + } _PyDict_NotifyEvent(tstate->interp, PyDict_EVENT_MODIFIED, dict, name, PyStackRef_AsPyObjectBorrow(value)); ep->me_value = PyStackRef_AsPyObjectSteal(value); // old_value should be DECREFed after GC track checking is done, if not, it could raise a segmentation fault, |