diff options
author | Hai Shi <shihai1992@gmail.com> | 2020-01-30 23:20:25 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-30 23:20:25 (GMT) |
commit | 46874c26ee1fc752e2e6930efa1d223b2351edb8 (patch) | |
tree | b4c85470214ac73ec6e4fa9981bb1f0e7b46472e /Python/_warnings.c | |
parent | c232c9110cfefa0935cbf158e35e91746a8a9361 (diff) | |
download | cpython-46874c26ee1fc752e2e6930efa1d223b2351edb8.zip cpython-46874c26ee1fc752e2e6930efa1d223b2351edb8.tar.gz cpython-46874c26ee1fc752e2e6930efa1d223b2351edb8.tar.bz2 |
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/_warnings.c')
-rw-r--r-- | Python/_warnings.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c index b8585d2..602211c 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -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; |