Skip to content

Commit ba1b4cc

Browse files
Leave space for the empty GC head.
1 parent 21ce6aa commit ba1b4cc

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

Include/internal/pycore_global_objects.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ extern "C" {
88
# error "this header requires Py_BUILD_CORE define"
99
#endif
1010

11+
#include "pycore_gc.h" // PyGC_Head
1112
#include "pycore_global_strings.h" // struct _Py_global_strings
1213

1314

@@ -41,6 +42,7 @@ struct _Py_global_objects {
4142

4243
struct _Py_global_strings strings;
4344

45+
PyGC_Head _tuple_empty_gc_not_used;
4446
PyTupleObject tuple_empty;
4547
} singletons;
4648
};

Include/internal/pycore_runtime_init.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ extern "C" {
934934
}, \
935935
\
936936
.tuple_empty = { \
937-
_PyVarObject_IMMORTAL_INIT(&PyTuple_Type, 0) \
937+
.ob_base = _PyVarObject_IMMORTAL_INIT(&PyTuple_Type, 0) \
938938
}, \
939939
}, \
940940
}

Tools/scripts/generate_global_objects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def generate_runtime_init(identifiers, strings):
250250
printer.write(f'INIT_ID({name}),')
251251
printer.write('')
252252
with printer.block('.tuple_empty =', ','):
253-
printer.write('_PyVarObject_IMMORTAL_INIT(&PyTuple_Type, 0)')
253+
printer.write('.ob_base = _PyVarObject_IMMORTAL_INIT(&PyTuple_Type, 0)')
254254
printer.write(END)
255255
printer.write(after)
256256

0 commit comments

Comments
 (0)