mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-131185: Use a proper thread-local for cached thread states (gh-132510)
Switches over to a _Py_thread_local in place of autoTssKey, and also fixes a few other checks regarding PyGILState_Ensure after finalization. Note that this doesn't fix concurrent use of PyGILState_Ensure with Py_Finalize; I'm pretty sure zapthreads doesn't work at all, and that needs to be fixed seperately.
This commit is contained in:
parent
dcfc91e4e5
commit
b8998fe2d8
7 changed files with 81 additions and 166 deletions
|
@ -61,9 +61,6 @@ extern PyTypeObject _PyExc_MemoryError;
|
|||
}, \
|
||||
}, \
|
||||
}, \
|
||||
/* A TSS key must be initialized with Py_tss_NEEDS_INIT \
|
||||
in accordance with the specification. */ \
|
||||
.autoTSSkey = Py_tss_NEEDS_INIT, \
|
||||
.parser = _parser_runtime_state_INIT, \
|
||||
.ceval = { \
|
||||
.pending_mainthread = { \
|
||||
|
@ -236,4 +233,4 @@ extern PyTypeObject _PyExc_MemoryError;
|
|||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_INTERNAL_RUNTIME_INIT_H */
|
||||
#endif /* !Py_INTERNAL_RUNTIME_INIT_H */
|
|
@ -223,9 +223,6 @@ struct pyruntimestate {
|
|||
struct _pythread_runtime_state threads;
|
||||
struct _signals_runtime_state signals;
|
||||
|
||||
/* Used for the thread state bound to the current thread. */
|
||||
Py_tss_t autoTSSkey;
|
||||
|
||||
/* Used instead of PyThreadState.trash when there is not current tstate. */
|
||||
Py_tss_t trashTSSkey;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue