mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-81057: Add PyInterpreterState.static_objects (gh-99397)
As we consolidate global variables, we find some objects that are almost suitable to add to _PyRuntimeState.global_objects, but have some small/sneaky bit of per-interpreter state (e.g. a weakref list). We're adding PyInterpreterState.static_objects so we can move such objects there. (We'll removed the _not_used field once we've added others.) https://github.com/python/cpython/issues/81057
This commit is contained in:
parent
dd36b71fa6
commit
f531b6879b
6 changed files with 35 additions and 5 deletions
|
@ -49,6 +49,24 @@ struct _Py_global_objects {
|
|||
PyObject *interned;
|
||||
};
|
||||
|
||||
#define _Py_INTERP_CACHED_OBJECT(interp, NAME) \
|
||||
(interp)->cached_objects.NAME
|
||||
|
||||
struct _Py_interp_cached_objects {
|
||||
int _not_set;
|
||||
};
|
||||
|
||||
#define _Py_INTERP_STATIC_OBJECT(interp, NAME) \
|
||||
(interp)->static_objects.NAME
|
||||
#define _Py_INTERP_SINGLETON(interp, NAME) \
|
||||
_Py_INTERP_STATIC_OBJECT(interp, singletons.NAME)
|
||||
|
||||
struct _Py_interp_static_objects {
|
||||
struct {
|
||||
int _not_used;
|
||||
} singletons;
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue