mirror of
https://github.com/python/cpython.git
synced 2025-10-06 15:11:58 +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
|
@ -268,6 +268,8 @@ parse_literal(PyObject *fmt, Py_ssize_t *ppos, PyArena *arena)
|
|||
PyObject *str = PyUnicode_Substring(fmt, start, pos);
|
||||
/* str = str.replace('%%', '%') */
|
||||
if (str && has_percents) {
|
||||
_Py_DECLARE_STR(percent, "%");
|
||||
_Py_DECLARE_STR(dbl_percent, "%%");
|
||||
Py_SETREF(str, PyUnicode_Replace(str, &_Py_STR(dbl_percent),
|
||||
&_Py_STR(percent), -1));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue