[Python-checkins] bpo-41117: Cleanup subtract_refs() (GH-27593)
vstinner
webhook-mailer at python.org
Wed Aug 4 12:09:32 EDT 2021
https://github.com/python/cpython/commit/c34fa2bb06ea44045af8493dfa414addb2b7ce66
commit: c34fa2bb06ea44045af8493dfa414addb2b7ce66
branch: main
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2021-08-04T18:09:14+02:00
summary:
bpo-41117: Cleanup subtract_refs() (GH-27593)
subtract_refs() reuses the 'op' variable rather than calling the
FROM_GC() macro twice.
Issue reported by William Pickard.
files:
M Modules/gcmodule.c
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
index e5e5aa3287b0d..2592c397cf2f7 100644
--- a/Modules/gcmodule.c
+++ b/Modules/gcmodule.c
@@ -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);
}
}
More information about the Python-checkins
mailing list