aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/gc.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2025-03-10 14:06:56 +0000
committerGitHub <noreply@github.com>2025-03-10 14:06:56 +0000
commit2bef8ea8ea045d20394f0daec7a5c5b1046a4e22 (patch)
treeeb4ee444fd0d58b788304c46839807475ea133ac /Python/gc.c
parent7cc99a54b755cc7cc0b3680fde7834cf612d4fbc (diff)
downloadcpython-2bef8ea8ea045d20394f0daec7a5c5b1046a4e22.tar.gz
cpython-2bef8ea8ea045d20394f0daec7a5c5b1046a4e22.zip
GH-127705: Use `_PyStackRef`s in the default build. (GH-127875)
Diffstat (limited to 'Python/gc.c')
-rw-r--r--Python/gc.c6
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) {