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.
This commit is contained in:
Hai Shi 2020-01-30 17:20:25 -06:00 committed by GitHub
parent c232c9110c
commit 46874c26ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 24 additions and 34 deletions

View file

@ -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);