]> granicus.if.org Git - python/commitdiff
Issue #19512: _print_total_refs() now uses an identifier to get "showrefcount"
authorVictor Stinner <victor.stinner@gmail.com>
Wed, 6 Nov 2013 17:28:21 +0000 (18:28 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Wed, 6 Nov 2013 17:28:21 +0000 (18:28 +0100)
key from sys._xoptions

Python/pythonrun.c

index 15a48f9947cff5319e29bfdd2d58b8bb96f3de02..dcd3664d141da8ad081bb5a0edf42dddddfd8f77 100644 (file)
 #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, "