mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +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,6 +24,8 @@ typedef struct _warnings_runtime_state WarningsState;
|
|||
/* Forward declaration of the _warnings module definition. */
|
||||
static struct PyModuleDef warningsmodule;
|
||||
|
||||
_Py_IDENTIFIER(__name__);
|
||||
|
||||
/* Given a module object, get its per-module state. */
|
||||
static WarningsState *
|
||||
_Warnings_GetState()
|
||||
|
@ -484,7 +486,6 @@ show_warning(PyObject *filename, int lineno, PyObject *text,
|
|||
PyObject *f_stderr;
|
||||
PyObject *name;
|
||||
char lineno_str[128];
|
||||
_Py_IDENTIFIER(__name__);
|
||||
|
||||
PyOS_snprintf(lineno_str, sizeof(lineno_str), ":%d: ", lineno);
|
||||
|
||||
|
@ -818,7 +819,6 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno,
|
|||
PyObject **module, PyObject **registry)
|
||||
{
|
||||
_Py_IDENTIFIER(__warningregistry__);
|
||||
_Py_IDENTIFIER(__name__);
|
||||
PyObject *globals;
|
||||
|
||||
/* Setup globals, filename and lineno. */
|
||||
|
@ -969,7 +969,6 @@ get_source_line(PyObject *module_globals, int lineno)
|
|||
{
|
||||
_Py_IDENTIFIER(get_source);
|
||||
_Py_IDENTIFIER(__loader__);
|
||||
_Py_IDENTIFIER(__name__);
|
||||
PyObject *loader;
|
||||
PyObject *module_name;
|
||||
PyObject *get_source;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue