Commit 7a07e451 authored by Victor Stinner's avatar Victor Stinner

Issue #19512: Py_ReprEnter() and Py_ReprLeave() now use an identifier for the

"Py_Repr" dictionary key
parent 95701bdf
...@@ -1969,7 +1969,7 @@ _PyObject_DebugTypeStats(FILE *out) ...@@ -1969,7 +1969,7 @@ _PyObject_DebugTypeStats(FILE *out)
See dictobject.c and listobject.c for examples of use. See dictobject.c and listobject.c for examples of use.
*/ */
#define KEY "Py_Repr" _Py_IDENTIFIER(Py_Repr);
int int
Py_ReprEnter(PyObject *obj) Py_ReprEnter(PyObject *obj)
...@@ -1981,12 +1981,12 @@ Py_ReprEnter(PyObject *obj) ...@@ -1981,12 +1981,12 @@ Py_ReprEnter(PyObject *obj)
dict = PyThreadState_GetDict(); dict = PyThreadState_GetDict();
if (dict == NULL) if (dict == NULL)
return 0; return 0;
list = PyDict_GetItemString(dict, KEY); list = _PyDict_GetItemId(dict, &PyId_Py_Repr);
if (list == NULL) { if (list == NULL) {
list = PyList_New(0); list = PyList_New(0);
if (list == NULL) if (list == NULL)
return -1; return -1;
if (PyDict_SetItemString(dict, KEY, list) < 0) if (_PyDict_SetItemId(dict, &PyId_Py_Repr, list) < 0)
return -1; return -1;
Py_DECREF(list); Py_DECREF(list);
} }
...@@ -2014,7 +2014,7 @@ Py_ReprLeave(PyObject *obj) ...@@ -2014,7 +2014,7 @@ Py_ReprLeave(PyObject *obj)
if (dict == NULL) if (dict == NULL)
goto finally; goto finally;
list = PyDict_GetItemString(dict, KEY); list = _PyDict_GetItemId(dict, &PyId_Py_Repr);
if (list == NULL || !PyList_Check(list)) if (list == NULL || !PyList_Check(list))
goto finally; goto finally;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment