New submission from William Pickard <lollol22...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue41117>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to