diff options
author | Pablo Galindo <pablogsal@gmail.com> | 2022-01-14 21:20:56 (GMT) |
---|---|---|
committer | Pablo Galindo <pablogsal@gmail.com> | 2022-01-14 21:20:56 (GMT) |
commit | 2402f1e1f80499a870a86d848e5228d527d9be1d (patch) | |
tree | 3c9a8c5f87659b1610c880a0cbb93872f6f7b856 /Python/pystate.c | |
parent | 01d4fe09763a6e55e38d338bf45e8c35e32a3581 (diff) | |
parent | c5640ef87511c960e339af37b486678788be910a (diff) | |
download | cpython-2402f1e1f80499a870a86d848e5228d527d9be1d.zip cpython-2402f1e1f80499a870a86d848e5228d527d9be1d.tar.gz cpython-2402f1e1f80499a870a86d848e5228d527d9be1d.tar.bz2 |
Merge remote-tracking branch 'upstream/main'
Diffstat (limited to 'Python/pystate.c')
-rw-r--r-- | Python/pystate.c | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/Python/pystate.c b/Python/pystate.c index a18a159..4b698f2 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -10,6 +10,7 @@ #include "pycore_pylifecycle.h" #include "pycore_pymem.h" // _PyMem_SetDefaultAllocator() #include "pycore_pystate.h" // _PyThreadState_GET() +#include "pycore_runtime_init.h" // _PyRuntimeState_INIT #include "pycore_sysmodule.h" /* -------------------------------------------------------------------------- @@ -110,17 +111,7 @@ init_runtime(_PyRuntimeState *runtime, PyPreConfig_InitPythonConfig(&runtime->preconfig); - runtime->gilstate.check_enabled = 1; - - /* A TSS key must be initialized with Py_tss_NEEDS_INIT - in accordance with the specification. */ - Py_tss_t initial = Py_tss_NEEDS_INIT; - runtime->gilstate.autoTSSkey = initial; - runtime->interpreters.mutex = interpreters_mutex; - // This prevents interpreters from getting created - // until _PyInterpreterState_Enable() is called. - runtime->interpreters.next_id = -1; runtime->xidregistry.mutex = xidregistry_mutex; @@ -290,7 +281,6 @@ init_interpreter(PyInterpreterState *interp, assert(id > 0 || (id == 0 && interp == runtime->interpreters.main)); interp->id = id; - interp->id_refcount = -1; assert(runtime->interpreters.head == interp); assert(next != NULL || (interp == runtime->interpreters.main)); @@ -300,14 +290,6 @@ init_interpreter(PyInterpreterState *interp, _PyGC_InitState(&interp->gc); PyConfig_InitPythonConfig(&interp->config); _PyType_InitCache(interp); - interp->eval_frame = NULL; -#ifdef HAVE_DLOPEN -#if HAVE_DECL_RTLD_NOW - interp->dlopenflags = RTLD_NOW; -#else - interp->dlopenflags = RTLD_LAZY; -#endif -#endif interp->_initialized = 1; } @@ -784,21 +766,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; @@ -1036,10 +1016,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"); } |