mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +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
|
|
@ -28,13 +28,6 @@ extern "C" {
|
|||
/* The following is auto-generated by Tools/scripts/generate_global_objects.py. */
|
||||
struct _Py_global_strings {
|
||||
struct {
|
||||
STRUCT_FOR_STR(empty, "")
|
||||
STRUCT_FOR_STR(dot, ".")
|
||||
STRUCT_FOR_STR(comma_sep, ", ")
|
||||
STRUCT_FOR_STR(percent, "%")
|
||||
STRUCT_FOR_STR(dbl_percent, "%%")
|
||||
|
||||
// "anonymous" labels
|
||||
STRUCT_FOR_STR(anon_dictcomp, "<dictcomp>")
|
||||
STRUCT_FOR_STR(anon_genexpr, "<genexpr>")
|
||||
STRUCT_FOR_STR(anon_lambda, "<lambda>")
|
||||
|
|
@ -42,7 +35,12 @@ struct _Py_global_strings {
|
|||
STRUCT_FOR_STR(anon_module, "<module>")
|
||||
STRUCT_FOR_STR(anon_setcomp, "<setcomp>")
|
||||
STRUCT_FOR_STR(anon_string, "<string>")
|
||||
STRUCT_FOR_STR(comma_sep, ", ")
|
||||
STRUCT_FOR_STR(dbl_percent, "%%")
|
||||
STRUCT_FOR_STR(dot, ".")
|
||||
STRUCT_FOR_STR(dot_locals, ".<locals>")
|
||||
STRUCT_FOR_STR(empty, "")
|
||||
STRUCT_FOR_STR(percent, "%")
|
||||
} literals;
|
||||
|
||||
struct {
|
||||
|
|
@ -330,6 +328,7 @@ struct _Py_global_strings {
|
|||
#define _Py_STR(NAME) \
|
||||
(_Py_SINGLETON(strings.literals._ ## NAME._ascii.ob_base))
|
||||
|
||||
#define _Py_DECLARE_STR(name, str)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue