]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41117: Cleanup subtract_refs() (GH-27593)
authorVictor Stinner <vstinner@python.org>
Wed, 4 Aug 2021 16:09:14 +0000 (18:09 +0200)
committerGitHub <noreply@github.com>
Wed, 4 Aug 2021 16:09:14 +0000 (18:09 +0200)
subtract_refs() reuses the 'op' variable rather than calling the
FROM_GC() macro twice.

Issue reported by William Pickard.

Modules/gcmodule.c

index e5e5aa3287b0d6de82672549e785ec00cd19235f..2592c397cf2f7350c30bb222fccb675817f62660 100644 (file)
@@ -479,9 +479,9 @@ subtract_refs(PyGC_Head *containers)
     for (; gc != containers; gc = GC_NEXT(gc)) {
         PyObject *op = FROM_GC(gc);
         traverse = Py_TYPE(op)->tp_traverse;
-        (void) traverse(FROM_GC(gc),
-                       (visitproc)visit_decref,
-                       op);
+        (void) traverse(op,
+                        (visitproc)visit_decref,
+                        op);
     }
 }