From 2bef8ea8ea045d20394f0daec7a5c5b1046a4e22 Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Mon, 10 Mar 2025 14:06:56 +0000 Subject: GH-127705: Use `_PyStackRef`s in the default build. (GH-127875) --- Python/gc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Python/gc.c') 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) { -- cgit v1.2.3