summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_runtime.h
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2021-12-09 19:59:26 (GMT)
committerGitHub <noreply@github.com>2021-12-09 19:59:26 (GMT)
commitc8749b578324ad4089c8d014d9136bc42b065343 (patch)
tree8b74af3da8568651c2c2068d9fe544617d70554f /Include/internal/pycore_runtime.h
parentd8a464ef0380692975d73a3a1513d901b6af8e65 (diff)
downloadcpython-c8749b578324ad4089c8d014d9136bc42b065343.zip
cpython-c8749b578324ad4089c8d014d9136bc42b065343.tar.gz
cpython-c8749b578324ad4089c8d014d9136bc42b065343.tar.bz2
bpo-46008: Make runtime-global object/type lifecycle functions and state consistent. (gh-29998)
This change is strictly renames and moving code around. It helps in the following ways: * ensures type-related init functions focus strictly on one of the three aspects (state, objects, types) * passes in PyInterpreterState * to all those functions, simplifying work on moving types/objects/state to the interpreter * consistent naming conventions help make what's going on more clear * keeping API related to a type in the corresponding header file makes it more obvious where to look for it https://bugs.python.org/issue46008
Diffstat (limited to 'Include/internal/pycore_runtime.h')
-rw-r--r--Include/internal/pycore_runtime.h24
1 files changed, 3 insertions, 21 deletions
diff --git a/Include/internal/pycore_runtime.h b/Include/internal/pycore_runtime.h
index 39e30b7..bd88510 100644
--- a/Include/internal/pycore_runtime.h
+++ b/Include/internal/pycore_runtime.h
@@ -10,14 +10,8 @@ extern "C" {
#include "pycore_atomic.h" /* _Py_atomic_address */
#include "pycore_gil.h" // struct _gil_runtime_state
-
-#define _PY_NSMALLPOSINTS 257
-#define _PY_NSMALLNEGINTS 5
-
-// _PyLong_GetZero() and _PyLong_GetOne() must always be available
-#if _PY_NSMALLPOSINTS < 2
-# error "_PY_NSMALLPOSINTS must be greater than 1"
-#endif
+#include "pycore_long_state.h" // struct _Py_long_state
+#include "pycore_unicodeobject.h" // struct _Py_unicode_runtime_ids
/* ceval state */
@@ -57,13 +51,6 @@ typedef struct _Py_AuditHookEntry {
void *userData;
} _Py_AuditHookEntry;
-struct _Py_unicode_runtime_ids {
- PyThread_type_lock lock;
- // next_index value must be preserved when Py_Initialize()/Py_Finalize()
- // is called multiple times: see _PyUnicode_FromId() implementation.
- Py_ssize_t next_index;
-};
-
/* Full Python runtime state */
typedef struct pyruntimestate {
@@ -114,12 +101,7 @@ typedef struct pyruntimestate {
unsigned long main_thread;
- /* Small integers are preallocated in this array so that they
- * can be shared.
- * The integers that are preallocated are those in the range
- *-_PY_NSMALLNEGINTS (inclusive) to _PY_NSMALLPOSINTS (not inclusive).
- */
- PyLongObject small_ints[_PY_NSMALLNEGINTS + _PY_NSMALLPOSINTS];
+ struct _Py_long_state int_state;
#define NEXITFUNCS 32
void (*exitfuncs[NEXITFUNCS])(void);