summaryrefslogtreecommitdiff
path: root/Include/internal/pycore_global_objects.h
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2022-11-14 13:50:56 -0700
committerGitHub <noreply@github.com>2022-11-14 13:50:56 -0700
commita088290f9d53a6bd078de6ee67b2fa296fc1cc14 (patch)
treecd464c7ed31b1fd4ea145eaa8cb073a7fac70985 /Include/internal/pycore_global_objects.h
parent619cadcda6a8ba4a038c1807b6566a90e25db934 (diff)
downloadcpython-git-a088290f9d53a6bd078de6ee67b2fa296fc1cc14.tar.gz
gh-81057: Move Global Variables Holding Objects to _PyRuntimeState. (gh-99487)
This moves nearly all remaining object-holding globals in core code (other than static types). https://github.com/python/cpython/issues/81057
Diffstat (limited to 'Include/internal/pycore_global_objects.h')
-rw-r--r--Include/internal/pycore_global_objects.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/Include/internal/pycore_global_objects.h b/Include/internal/pycore_global_objects.h
index 3561f686a0..5ad1f7d217 100644
--- a/Include/internal/pycore_global_objects.h
+++ b/Include/internal/pycore_global_objects.h
@@ -10,6 +10,7 @@ extern "C" {
#include "pycore_gc.h" // PyGC_Head
#include "pycore_global_strings.h" // struct _Py_global_strings
+#include "pycore_typeobject.h" // pytype_slotdef
// These would be in pycore_long.h if it weren't for an include cycle.
@@ -20,6 +21,13 @@ 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 *str_replace_inf;
+};
+
#define _Py_GLOBAL_OBJECT(NAME) \
_PyRuntime.global_objects.NAME
#define _Py_SINGLETON(NAME) \
@@ -54,6 +62,10 @@ struct _Py_global_objects {
struct _Py_interp_cached_objects {
int _not_set;
+ /* object.__reduce__ */
+ PyObject *objreduce;
+ PyObject *type_slots_pname;
+ pytype_slotdef *type_slots_ptrs[MAX_EQUIV];
};
#define _Py_INTERP_STATIC_OBJECT(interp, NAME) \