Skip to content

Commit 6c62b40

Browse files
committed
Don't use a full PyThreadState for NO_TSTATE_SENTINEL on release builds.
1 parent 31f1155 commit 6c62b40

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Python/pystate.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3510,7 +3510,14 @@ PyInterpreterView_FromMain(void)
35103510
// thread state was attached.
35113511
// To do this, we just use the memory address of a global variable and
35123512
// cast it to a PyThreadState *.
3513+
#ifdef Py_DEBUG
3514+
// For debugging, use a null thread state. Since thread states are large, we
3515+
// don't want to do this on release builds.
35133516
static const PyThreadState _no_tstate_sentinel = {0};
3517+
#else
3518+
static const uint8_t _no_tstate_sentinel = 0;
3519+
#endif
3520+
35143521
#define NO_TSTATE_SENTINEL ((PyThreadState *)&_no_tstate_sentinel)
35153522

35163523
static inline void

0 commit comments

Comments
 (0)