Description
Bug report
Bug description:
Hi,
I am unsure if this intentional or not so apologies if this turns out not to be a bug.
The code for _Py_RefcntAdd
does not include _Py_INCREF_STAT_INC
. This appears to mean the statistics do not track these additions to the reference count, which are increments (although not increments by 1
, they are increasing the ref count in a single operation).
cpython/Include/internal/pycore_object.h
Line 121 in ad9d059
I believe this may be an oversight because this stat should be tracked, and also because the corresponding decrement ref count code does call _Py_DECREF_STAT_INC
(e.g.
cpython/Include/internal/pycore_object.h
Line 383 in ad9d059
I have checked the callers of _Py_RefcntAdd
(in listobject.c
and tupleobject.c
) and they do not separately perform the stats tracking.
Is this an issue or is there a reason this ref count increment is excluded?
Thanks,
Ed
CPython versions tested on:
3.12, 3.13
Operating systems tested on:
Linux, macOS
Linked PRs
- gh-127599: Fix _Py_RefcntAdd missing calls to _Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC #127717
- [3.13] gh-127599: Fix _Py_RefcntAdd missing calls to _Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC (GH-127717) #127963
- [3.12] gh-127599: Fix _Py_RefcntAdd missing calls to _Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC (GH-127717) #128712
- [3.13] gh-127599: Fix _Py_RefcntAdd missing calls to _Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC (GH-127717) #128713