mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
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:
parent
c232c9110c
commit
46874c26ee
12 changed files with 24 additions and 34 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue