diff options
Diffstat (limited to 'Python/gc.c')
-rw-r--r-- | Python/gc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/gc.c b/Python/gc.c index 7faf368f358..f2a88657e8d 100644 --- a/Python/gc.c +++ b/Python/gc.c @@ -1488,11 +1488,11 @@ mark_stacks(PyInterpreterState *interp, PyGC_Head *visited, int visited_space, b objects_marked += move_to_reachable(func, &reachable, visited_space); while (sp > locals) { sp--; - if (PyStackRef_IsNull(*sp)) { + PyObject *op = PyStackRef_AsPyObjectBorrow(*sp); + if (op == NULL || _Py_IsImmortal(op)) { continue; } - PyObject *op = PyStackRef_AsPyObjectBorrow(*sp); - if (!_Py_IsImmortal(op) && _PyObject_IS_GC(op)) { + if (_PyObject_IS_GC(op)) { PyGC_Head *gc = AS_GC(op); if (_PyObject_GC_IS_TRACKED(op) && gc_old_space(gc) != visited_space) { |