mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #19512: _print_total_refs() now uses an identifier to get "showrefcount"
key from sys._xoptions
This commit is contained in:
parent
d02fbb8f71
commit
4ee41c5839
1 changed files with 4 additions and 6 deletions
|
@ -38,15 +38,13 @@
|
||||||
#ifdef Py_REF_DEBUG
|
#ifdef Py_REF_DEBUG
|
||||||
static
|
static
|
||||||
void _print_total_refs(void) {
|
void _print_total_refs(void) {
|
||||||
PyObject *xoptions, *key, *value;
|
PyObject *xoptions, *value;
|
||||||
|
_Py_IDENTIFIER(showrefcount);
|
||||||
|
|
||||||
xoptions = PySys_GetXOptions();
|
xoptions = PySys_GetXOptions();
|
||||||
if (xoptions == NULL)
|
if (xoptions == NULL)
|
||||||
return;
|
return;
|
||||||
key = PyUnicode_FromString("showrefcount");
|
value = _PyDict_GetItemId(xoptions, &PyId_showrefcount);
|
||||||
if (key == NULL)
|
|
||||||
return;
|
|
||||||
value = PyDict_GetItem(xoptions, key);
|
|
||||||
Py_DECREF(key);
|
|
||||||
if (value == Py_True)
|
if (value == Py_True)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"[%" PY_FORMAT_SIZE_T "d refs, "
|
"[%" PY_FORMAT_SIZE_T "d refs, "
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue