mirror of
https://github.com/python/cpython.git
synced 2025-07-10 04:45:36 +00:00
bpo-46541: Discover the global strings. (gh-31346)
Instead of manually enumerating the global strings in generate_global_objects.py, we extrapolate the list from usage of _Py_ID() and _Py_STR() in the source files. This is partly inspired by gh-31261. https://bugs.python.org/issue46541
This commit is contained in:
parent
278fdd3e3a
commit
12360aa159
9 changed files with 103 additions and 274 deletions
|
@ -515,6 +515,7 @@ parse_syntax_error(PyObject *err, PyObject **message, PyObject **filename,
|
|||
goto finally;
|
||||
if (v == Py_None) {
|
||||
Py_DECREF(v);
|
||||
_Py_DECLARE_STR(anon_string, "<string>");
|
||||
*filename = &_Py_STR(anon_string);
|
||||
Py_INCREF(*filename);
|
||||
}
|
||||
|
@ -1562,6 +1563,7 @@ PyRun_StringFlags(const char *str, int start, PyObject *globals,
|
|||
if (arena == NULL)
|
||||
return NULL;
|
||||
|
||||
_Py_DECLARE_STR(anon_string, "<string>");
|
||||
mod = _PyParser_ASTFromString(
|
||||
str, &_Py_STR(anon_string), start, flags, arena);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue