Issue #19512: _print_total_refs() now uses an identifier to get "showrefcount"

key from sys._xoptions
This commit is contained in:
Victor Stinner 2013-11-06 18:28:21 +01:00
parent d02fbb8f71
commit 4ee41c5839

View File

@ -38,15 +38,13 @@
#ifdef Py_REF_DEBUG
static
void _print_total_refs(void) {
PyObject *xoptions, *key, *value;
PyObject *xoptions, *value;
_Py_IDENTIFIER(showrefcount);
xoptions = PySys_GetXOptions();
if (xoptions == NULL)
return;
key = PyUnicode_FromString("showrefcount");
if (key == NULL)
return;
value = PyDict_GetItem(xoptions, key);
Py_DECREF(key);
value = _PyDict_GetItemId(xoptions, &PyId_showrefcount);
if (value == Py_True)
fprintf(stderr,
"[%" PY_FORMAT_SIZE_T "d refs, "