diff Python/pythonrun.c @ 86965:55517661a053

Issue #19512: _print_total_refs() now uses an identifier to get "showrefcount" key from sys._xoptions
author Victor Stinner <victor.stinner@gmail.com>
date Wed, 06 Nov 2013 18:28:21 +0100
parents b5cc822d5bf0
children af822a6c9faf
line wrap: on
line diff
--- a/Python/pythonrun.c	Wed Nov 06 18:27:13 2013 +0100
+++ b/Python/pythonrun.c	Wed Nov 06 18:28:21 2013 +0100
@@ -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, "