Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
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 by1, they are increasing the ref count in a single operation).
cpython/Include/internal/pycore_object.h
Line 121 inad9d059
| staticinlinevoid_Py_RefcntAdd(PyObject*op,Py_ssize_tn) |
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 inad9d059
| _Py_DECREF_STAT_INC(); |
I have checked the callers of_Py_RefcntAdd (inlistobject.c andtupleobject.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