From 46874c26ee1fc752e2e6930efa1d223b2351edb8 Mon Sep 17 00:00:00 2001 From: Hai Shi Date: Thu, 30 Jan 2020 17:20:25 -0600 Subject: bpo-39487: Merge duplicated _Py_IDENTIFIER identifiers in C code (GH-18254) Moving repetitive `_Py_IDENTIFIER` instances to a global location helps identify them more easily in regards to sub-interpreter support. --- Python/errors.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Python/errors.c') diff --git a/Python/errors.c b/Python/errors.c index 18ea9c5652..652f4c9de7 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -24,11 +24,11 @@ extern char *strerror(int); extern "C" { #endif +_Py_IDENTIFIER(__module__); _Py_IDENTIFIER(builtins); _Py_IDENTIFIER(stderr); _Py_IDENTIFIER(flush); - /* Forward declarations */ static PyObject * _PyErr_FormatV(PyThreadState *tstate, PyObject *exception, @@ -1009,7 +1009,6 @@ PyObject * PyErr_NewException(const char *name, PyObject *base, PyObject *dict) { PyThreadState *tstate = _PyThreadState_GET(); - _Py_IDENTIFIER(__module__); PyObject *modulename = NULL; PyObject *classname = NULL; PyObject *mydict = NULL; @@ -1235,7 +1234,6 @@ write_unraisable_exc_file(PyThreadState *tstate, PyObject *exc_type, } } - _Py_IDENTIFIER(__module__); PyObject *moduleName = _PyObject_GetAttrId(exc_type, &PyId___module__); if (moduleName == NULL || !PyUnicode_Check(moduleName)) { Py_XDECREF(moduleName); -- cgit v1.2.1