diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2022-01-14 00:09:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-14 00:09:24 (GMT) |
commit | 324908ba936d5d262026deebb81f050803848c41 (patch) | |
tree | a45363816b664cbe18eb899e33688d7f3bc09e59 /Python | |
parent | d4e64cd4b0ea431d4e371f9b0a25f6b75a069dc1 (diff) | |
download | cpython-324908ba936d5d262026deebb81f050803848c41.zip cpython-324908ba936d5d262026deebb81f050803848c41.tar.gz cpython-324908ba936d5d262026deebb81f050803848c41.tar.bz2 |
bpo-45953: Statically initialize all the PyThreadState fields we can. (gh-30590)
https://bugs.python.org/issue45953
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 4 | ||||
-rw-r--r-- | Python/pystate.c | 12 |
2 files changed, 5 insertions, 11 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index d33cd4e..eed902f 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -737,10 +737,6 @@ Py_MakePendingCalls(void) /* The interpreter's recursion limit */ -#ifndef Py_DEFAULT_RECURSION_LIMIT -# define Py_DEFAULT_RECURSION_LIMIT 1000 -#endif - void _PyEval_InitRuntimeState(struct _ceval_runtime_state *ceval) { diff --git a/Python/pystate.c b/Python/pystate.c index 50b3621..2315685 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -775,21 +775,19 @@ init_threadstate(PyThreadState *tstate, next->prev = tstate; } tstate->next = next; - tstate->prev = NULL; + assert(tstate->prev == NULL); tstate->thread_id = PyThread_get_thread_ident(); #ifdef PY_HAVE_THREAD_NATIVE_ID tstate->native_thread_id = PyThread_get_thread_native_id(); #endif - tstate->context_ver = 1; - tstate->recursion_limit = interp->ceval.recursion_limit, tstate->recursion_remaining = interp->ceval.recursion_limit, - tstate->exc_info = &tstate->exc_state; + tstate->exc_info = &tstate->_exc_state; - tstate->cframe = &tstate->root_cframe; + tstate->cframe = &tstate->_root_cframe; tstate->datastack_chunk = NULL; tstate->datastack_top = NULL; tstate->datastack_limit = NULL; @@ -1027,10 +1025,10 @@ PyThreadState_Clear(PyThreadState *tstate) Py_CLEAR(tstate->curexc_value); Py_CLEAR(tstate->curexc_traceback); - Py_CLEAR(tstate->exc_state.exc_value); + Py_CLEAR(tstate->_exc_state.exc_value); /* The stack of exception states should contain just this thread. */ - if (verbose && tstate->exc_info != &tstate->exc_state) { + if (verbose && tstate->exc_info != &tstate->_exc_state) { fprintf(stderr, "PyThreadState_Clear: warning: thread still has a generator\n"); } |