[issue41117] [easy C] GC: Use local variable 'op' when invoking 'traverse' in 'subtract_refs'
William Pickard
report at bugs.python.org
Thu Jun 25 12:35:27 EDT 2020
New submission from William Pickard <lollol222gg at gmail.com>:
When the GC module goes to collect objects (most notably, during Python shutdown), it makes a call to subtract_refs on the GC container.
During this invocation, it creates a local variable "op" who's value is the result of 'FROM_GC(gc)', but when it goes to use the obtained 'traverse' method, it calls FROM_GC(gc) instead of using 'op'.
This, unfortunately, makes it rather difficult to debug "Access Violations" for extension modules for when 'traverse' is 'NULL' as inspecting the variable 'op' in the chosen debugger (for my case: Visual Studio on Windows) is impossible.
This can potentially introduce a micro optimization in the overall runtime of the GC module as it no longer has to invoke the addition instruction (if it does) to construct the first parameter of the 'traverse' call.
----------
components: C API, Interpreter Core
files: cpython.patch
keywords: patch
messages: 372380
nosy: WildCard65
priority: normal
severity: normal
status: open
title: [easy C] GC: Use local variable 'op' when invoking 'traverse' in 'subtract_refs'
type: enhancement
versions: Python 3.10
Added file: https://bugs.python.org/file49261/cpython.patch
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41117>
_______________________________________
More information about the Python-bugs-list
mailing list