mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-100227: Move the Dict of Interned Strings to PyInterpreterState (gh-102339)
We can revisit the options for keeping it global later, if desired. For now the approach seems quite complex, so we've gone with the simpler isolation solution in the meantime. https://github.com/python/cpython/issues/100227
This commit is contained in:
parent
7703def37e
commit
ba65a065cf
6 changed files with 727 additions and 718 deletions
|
@ -23,13 +23,6 @@ extern "C" {
|
|||
// Only immutable objects should be considered runtime-global.
|
||||
// All others must be per-interpreter.
|
||||
|
||||
#define _Py_CACHED_OBJECT(NAME) \
|
||||
_PyRuntime.cached_objects.NAME
|
||||
|
||||
struct _Py_cached_objects {
|
||||
PyObject *interned_strings;
|
||||
};
|
||||
|
||||
#define _Py_GLOBAL_OBJECT(NAME) \
|
||||
_PyRuntime.static_objects.NAME
|
||||
#define _Py_SINGLETON(NAME) \
|
||||
|
@ -65,6 +58,8 @@ struct _Py_static_objects {
|
|||
(interp)->cached_objects.NAME
|
||||
|
||||
struct _Py_interp_cached_objects {
|
||||
PyObject *interned_strings;
|
||||
|
||||
/* AST */
|
||||
PyObject *str_replace_inf;
|
||||
|
||||
|
|
|
@ -163,7 +163,6 @@ typedef struct pyruntimestate {
|
|||
} types;
|
||||
|
||||
/* All the objects that are shared by the runtime's interpreters. */
|
||||
struct _Py_cached_objects cached_objects;
|
||||
struct _Py_static_objects static_objects;
|
||||
|
||||
/* The following fields are here to avoid allocation during init.
|
||||
|
|
|
@ -59,6 +59,7 @@ struct _Py_unicode_state {
|
|||
struct _Py_unicode_ids ids;
|
||||
};
|
||||
|
||||
extern void _PyUnicode_InternInPlace(PyInterpreterState *interp, PyObject **p);
|
||||
extern void _PyUnicode_ClearInterned(PyInterpreterState *interp);
|
||||
|
||||
|
||||
|
|
1332
Include/internal/pycore_unicodeobject_generated.h
generated
1332
Include/internal/pycore_unicodeobject_generated.h
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue