From 4ee41c5839b29226f2fc4893555638953f44c71f Mon Sep 17 00:00:00 2001 From: Victor Stinner <victor.stinner@gmail.com> Date: Wed, 6 Nov 2013 18:28:21 +0100 Subject: Issue #19512: _print_total_refs() now uses an identifier to get "showrefcount" key from sys._xoptions --- Python/pythonrun.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 15a48f9..dcd3664 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -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, " -- cgit v0.12