summaryrefslogtreecommitdiffstats
path: root/Include/internal
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2022-02-23 00:23:51 (GMT)
committerGitHub <noreply@github.com>2022-02-23 00:23:51 (GMT)
commit1f455361ecfb1892e375bdbee813cdf095b6cfb8 (patch)
treed7def4d5d167965a45c4b0e30bb5a1a0bb5c3b4a /Include/internal
parentcff4d5c5d29528299ec1ac5b3b3a6f7735577c01 (diff)
downloadcpython-1f455361ecfb1892e375bdbee813cdf095b6cfb8.zip
cpython-1f455361ecfb1892e375bdbee813cdf095b6cfb8.tar.gz
cpython-1f455361ecfb1892e375bdbee813cdf095b6cfb8.tar.bz2
bpo-46765: Replace Locally Cached Strings with Statically Initialized Objects (gh-31366)
https://bugs.python.org/issue46765
Diffstat (limited to 'Include/internal')
-rw-r--r--Include/internal/pycore_global_strings.h32
-rw-r--r--Include/internal/pycore_runtime_init.h32
-rw-r--r--Include/internal/pycore_symtable.h2
3 files changed, 64 insertions, 2 deletions
diff --git a/Include/internal/pycore_global_strings.h b/Include/internal/pycore_global_strings.h
index aa597bc..2a42dc1 100644
--- a/Include/internal/pycore_global_strings.h
+++ b/Include/internal/pycore_global_strings.h
@@ -35,17 +35,26 @@ 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(anon_unknown, "<unknown>")
+ STRUCT_FOR_STR(close_br, "}")
STRUCT_FOR_STR(comma_sep, ", ")
+ STRUCT_FOR_STR(dbl_close_br, "}}")
+ STRUCT_FOR_STR(dbl_open_br, "{{")
STRUCT_FOR_STR(dbl_percent, "%%")
STRUCT_FOR_STR(dot, ".")
STRUCT_FOR_STR(dot_locals, ".<locals>")
STRUCT_FOR_STR(empty, "")
+ STRUCT_FOR_STR(list_err, "list index out of range")
+ STRUCT_FOR_STR(newline, "\n")
+ STRUCT_FOR_STR(open_br, "{")
STRUCT_FOR_STR(percent, "%")
} literals;
struct {
+ STRUCT_FOR_ID(False)
STRUCT_FOR_ID(Py_Repr)
STRUCT_FOR_ID(TextIOWrapper)
+ STRUCT_FOR_ID(True)
STRUCT_FOR_ID(WarningMessage)
STRUCT_FOR_ID(_)
STRUCT_FOR_ID(__IOBase_closed)
@@ -194,7 +203,9 @@ struct _Py_global_strings {
STRUCT_FOR_ID(__weakref__)
STRUCT_FOR_ID(__xor__)
STRUCT_FOR_ID(_abc_impl)
+ STRUCT_FOR_ID(_annotation)
STRUCT_FOR_ID(_blksize)
+ STRUCT_FOR_ID(_bootstrap)
STRUCT_FOR_ID(_dealloc_warn)
STRUCT_FOR_ID(_finalizing)
STRUCT_FOR_ID(_find_and_load)
@@ -216,23 +227,31 @@ struct _Py_global_strings {
STRUCT_FOR_ID(big)
STRUCT_FOR_ID(buffer)
STRUCT_FOR_ID(builtins)
+ STRUCT_FOR_ID(c_call)
+ STRUCT_FOR_ID(c_exception)
+ STRUCT_FOR_ID(c_return)
+ STRUCT_FOR_ID(call)
STRUCT_FOR_ID(clear)
STRUCT_FOR_ID(close)
+ STRUCT_FOR_ID(closed)
STRUCT_FOR_ID(code)
STRUCT_FOR_ID(copy)
STRUCT_FOR_ID(copyreg)
STRUCT_FOR_ID(decode)
STRUCT_FOR_ID(default)
STRUCT_FOR_ID(defaultaction)
+ STRUCT_FOR_ID(dictcomp)
STRUCT_FOR_ID(difference_update)
STRUCT_FOR_ID(dispatch_table)
STRUCT_FOR_ID(displayhook)
STRUCT_FOR_ID(enable)
+ STRUCT_FOR_ID(encode)
STRUCT_FOR_ID(encoding)
STRUCT_FOR_ID(end_lineno)
STRUCT_FOR_ID(end_offset)
STRUCT_FOR_ID(errors)
STRUCT_FOR_ID(excepthook)
+ STRUCT_FOR_ID(exception)
STRUCT_FOR_ID(extend)
STRUCT_FOR_ID(filename)
STRUCT_FOR_ID(fileno)
@@ -240,22 +259,30 @@ struct _Py_global_strings {
STRUCT_FOR_ID(filters)
STRUCT_FOR_ID(find_class)
STRUCT_FOR_ID(flush)
+ STRUCT_FOR_ID(genexpr)
STRUCT_FOR_ID(get)
STRUCT_FOR_ID(get_source)
STRUCT_FOR_ID(getattr)
+ STRUCT_FOR_ID(getstate)
STRUCT_FOR_ID(ignore)
STRUCT_FOR_ID(importlib)
+ STRUCT_FOR_ID(inf)
STRUCT_FOR_ID(intersection)
STRUCT_FOR_ID(isatty)
STRUCT_FOR_ID(items)
STRUCT_FOR_ID(iter)
+ STRUCT_FOR_ID(join)
STRUCT_FOR_ID(keys)
+ STRUCT_FOR_ID(lambda)
STRUCT_FOR_ID(last_traceback)
STRUCT_FOR_ID(last_type)
STRUCT_FOR_ID(last_value)
STRUCT_FOR_ID(latin1)
+ STRUCT_FOR_ID(line)
STRUCT_FOR_ID(lineno)
+ STRUCT_FOR_ID(listcomp)
STRUCT_FOR_ID(little)
+ STRUCT_FOR_ID(locale)
STRUCT_FOR_ID(match)
STRUCT_FOR_ID(metaclass)
STRUCT_FOR_ID(mode)
@@ -266,9 +293,11 @@ struct _Py_global_strings {
STRUCT_FOR_ID(n_sequence_fields)
STRUCT_FOR_ID(n_unnamed_fields)
STRUCT_FOR_ID(name)
+ STRUCT_FOR_ID(newlines)
STRUCT_FOR_ID(obj)
STRUCT_FOR_ID(offset)
STRUCT_FOR_ID(onceregistry)
+ STRUCT_FOR_ID(opcode)
STRUCT_FOR_ID(open)
STRUCT_FOR_ID(parent)
STRUCT_FOR_ID(partial)
@@ -296,6 +325,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(seek)
STRUCT_FOR_ID(seekable)
STRUCT_FOR_ID(send)
+ STRUCT_FOR_ID(setcomp)
STRUCT_FOR_ID(setstate)
STRUCT_FOR_ID(sort)
STRUCT_FOR_ID(stderr)
@@ -307,6 +337,8 @@ struct _Py_global_strings {
STRUCT_FOR_ID(text)
STRUCT_FOR_ID(threading)
STRUCT_FOR_ID(throw)
+ STRUCT_FOR_ID(top)
+ STRUCT_FOR_ID(truncate)
STRUCT_FOR_ID(unraisablehook)
STRUCT_FOR_ID(values)
STRUCT_FOR_ID(version)
diff --git a/Include/internal/pycore_runtime_init.h b/Include/internal/pycore_runtime_init.h
index 04c1e67..8f62343 100644
--- a/Include/internal/pycore_runtime_init.h
+++ b/Include/internal/pycore_runtime_init.h
@@ -651,16 +651,25 @@ extern "C" {
INIT_STR(anon_module, "<module>"), \
INIT_STR(anon_setcomp, "<setcomp>"), \
INIT_STR(anon_string, "<string>"), \
+ INIT_STR(anon_unknown, "<unknown>"), \
+ INIT_STR(close_br, "}"), \
INIT_STR(comma_sep, ", "), \
+ INIT_STR(dbl_close_br, "}}"), \
+ INIT_STR(dbl_open_br, "{{"), \
INIT_STR(dbl_percent, "%%"), \
INIT_STR(dot, "."), \
INIT_STR(dot_locals, ".<locals>"), \
INIT_STR(empty, ""), \
+ INIT_STR(list_err, "list index out of range"), \
+ INIT_STR(newline, "\n"), \
+ INIT_STR(open_br, "{"), \
INIT_STR(percent, "%"), \
}, \
.identifiers = { \
+ INIT_ID(False), \
INIT_ID(Py_Repr), \
INIT_ID(TextIOWrapper), \
+ INIT_ID(True), \
INIT_ID(WarningMessage), \
INIT_ID(_), \
INIT_ID(__IOBase_closed), \
@@ -809,7 +818,9 @@ extern "C" {
INIT_ID(__weakref__), \
INIT_ID(__xor__), \
INIT_ID(_abc_impl), \
+ INIT_ID(_annotation), \
INIT_ID(_blksize), \
+ INIT_ID(_bootstrap), \
INIT_ID(_dealloc_warn), \
INIT_ID(_finalizing), \
INIT_ID(_find_and_load), \
@@ -831,23 +842,31 @@ extern "C" {
INIT_ID(big), \
INIT_ID(buffer), \
INIT_ID(builtins), \
+ INIT_ID(c_call), \
+ INIT_ID(c_exception), \
+ INIT_ID(c_return), \
+ INIT_ID(call), \
INIT_ID(clear), \
INIT_ID(close), \
+ INIT_ID(closed), \
INIT_ID(code), \
INIT_ID(copy), \
INIT_ID(copyreg), \
INIT_ID(decode), \
INIT_ID(default), \
INIT_ID(defaultaction), \
+ INIT_ID(dictcomp), \
INIT_ID(difference_update), \
INIT_ID(dispatch_table), \
INIT_ID(displayhook), \
INIT_ID(enable), \
+ INIT_ID(encode), \
INIT_ID(encoding), \
INIT_ID(end_lineno), \
INIT_ID(end_offset), \
INIT_ID(errors), \
INIT_ID(excepthook), \
+ INIT_ID(exception), \
INIT_ID(extend), \
INIT_ID(filename), \
INIT_ID(fileno), \
@@ -855,22 +874,30 @@ extern "C" {
INIT_ID(filters), \
INIT_ID(find_class), \
INIT_ID(flush), \
+ INIT_ID(genexpr), \
INIT_ID(get), \
INIT_ID(get_source), \
INIT_ID(getattr), \
+ INIT_ID(getstate), \
INIT_ID(ignore), \
INIT_ID(importlib), \
+ INIT_ID(inf), \
INIT_ID(intersection), \
INIT_ID(isatty), \
INIT_ID(items), \
INIT_ID(iter), \
+ INIT_ID(join), \
INIT_ID(keys), \
+ INIT_ID(lambda), \
INIT_ID(last_traceback), \
INIT_ID(last_type), \
INIT_ID(last_value), \
INIT_ID(latin1), \
+ INIT_ID(line), \
INIT_ID(lineno), \
+ INIT_ID(listcomp), \
INIT_ID(little), \
+ INIT_ID(locale), \
INIT_ID(match), \
INIT_ID(metaclass), \
INIT_ID(mode), \
@@ -881,9 +908,11 @@ extern "C" {
INIT_ID(n_sequence_fields), \
INIT_ID(n_unnamed_fields), \
INIT_ID(name), \
+ INIT_ID(newlines), \
INIT_ID(obj), \
INIT_ID(offset), \
INIT_ID(onceregistry), \
+ INIT_ID(opcode), \
INIT_ID(open), \
INIT_ID(parent), \
INIT_ID(partial), \
@@ -911,6 +940,7 @@ extern "C" {
INIT_ID(seek), \
INIT_ID(seekable), \
INIT_ID(send), \
+ INIT_ID(setcomp), \
INIT_ID(setstate), \
INIT_ID(sort), \
INIT_ID(stderr), \
@@ -922,6 +952,8 @@ extern "C" {
INIT_ID(text), \
INIT_ID(threading), \
INIT_ID(throw), \
+ INIT_ID(top), \
+ INIT_ID(truncate), \
INIT_ID(unraisablehook), \
INIT_ID(values), \
INIT_ID(version), \
diff --git a/Include/internal/pycore_symtable.h b/Include/internal/pycore_symtable.h
index 4ecfab5..28935f4 100644
--- a/Include/internal/pycore_symtable.h
+++ b/Include/internal/pycore_symtable.h
@@ -128,8 +128,6 @@ extern struct symtable* _Py_SymtableStringObjectFlags(
int start,
PyCompilerFlags *flags);
-extern void _PySymtable_Fini(void);
-
#ifdef __cplusplus
}
#endif