Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-100227: Move the Dict of Interned Strings to PyInterpreterState #102339

Merged
9 changes: 2 additions & 7 deletions Include/internal/pycore_global_objects.h
Expand Up @@ -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) \
Expand Down Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion Include/internal/pycore_runtime.h
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions Include/internal/pycore_unicodeobject.h
Expand Up @@ -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);


Expand Down