Skip to content

Commit 2c6dd5c

Browse files
committed
Set old space for objects in finalizer list before adding to old space
1 parent 4bf4187 commit 2c6dd5c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Python/gc.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1003,10 +1003,11 @@ handle_legacy_finalizers(PyThreadState *tstate,
10031003
assert(!_PyErr_Occurred(tstate));
10041004
assert(gcstate->garbage != NULL);
10051005

1006+
int old_space = gc_old_space(old);
10061007
PyGC_Head *gc = GC_NEXT(finalizers);
10071008
for (; gc != finalizers; gc = GC_NEXT(gc)) {
1009+
gc_set_old_space(gc, old_space);
10081010
PyObject *op = FROM_GC(gc);
1009-
10101011
if ((gcstate->debug & _PyGC_DEBUG_SAVEALL) || has_legacy_finalizer(op)) {
10111012
if (PyList_Append(gcstate->garbage, op) < 0) {
10121013
_PyErr_Clear(tstate);

0 commit comments

Comments
 (0)