summaryrefslogtreecommitdiff
path: root/Python/errors.c
diff options
context:
space:
mode:
authorHai Shi <shihai1992@gmail.com>2020-01-30 17:20:25 -0600
committerGitHub <noreply@github.com>2020-01-30 15:20:25 -0800
commit46874c26ee1fc752e2e6930efa1d223b2351edb8 (patch)
treeb4c85470214ac73ec6e4fa9981bb1f0e7b46472e /Python/errors.c
parentc232c9110cfefa0935cbf158e35e91746a8a9361 (diff)
downloadcpython-git-46874c26ee1fc752e2e6930efa1d223b2351edb8.tar.gz
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.
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c4
1 files changed, 1 insertions, 3 deletions
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);