[issue41117] [easy C] GC: Use local variable 'op' when invoking 'traverse' in 'subtract_refs'

2021-08-04 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner
nosy_count: 1.0 -> 2.0
pull_requests: +26094
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27593

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41117] [easy C] GC: Use local variable 'op' when invoking 'traverse' in 'subtract_refs'

2021-08-04 Thread STINNER Victor


STINNER Victor  added the comment:

I created PR 27593.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41117] [easy C] GC: Use local variable 'op' when invoking 'traverse' in 'subtract_refs'

2021-08-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset c34fa2bb06ea44045af8493dfa414addb2b7ce66 by Victor Stinner in 
branch 'main':
bpo-41117: Cleanup subtract_refs() (GH-27593)
https://github.com/python/cpython/commit/c34fa2bb06ea44045af8493dfa414addb2b7ce66


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41117] [easy C] GC: Use local variable 'op' when invoking 'traverse' in 'subtract_refs'

2021-08-04 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks William, I made the change that you suggested. Next time, please create 
a PR directly ;-)

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.11 -Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41117] [easy C] GC: Use local variable 'op' when invoking 'traverse' in 'subtract_refs'

2020-06-25 Thread William Pickard


New submission from William Pickard :

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com