summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c6
-rw-r--r--Python/fileutils.c37
-rw-r--r--Python/pylifecycle.c1
-rw-r--r--Python/pystate.c32
4 files changed, 8 insertions, 68 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index d33cd4e..70a7750 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)
{
@@ -752,8 +748,6 @@ _PyEval_InitRuntimeState(struct _ceval_runtime_state *ceval)
void
_PyEval_InitState(struct _ceval_state *ceval, PyThread_type_lock pending_lock)
{
- ceval->recursion_limit = Py_DEFAULT_RECURSION_LIMIT;
-
struct _pending_calls *pending = &ceval->pending;
assert(pending->lock == NULL);
diff --git a/Python/fileutils.c b/Python/fileutils.c
index 151c6fe..9a71b83 100644
--- a/Python/fileutils.c
+++ b/Python/fileutils.c
@@ -2049,42 +2049,7 @@ _Py_abspath(const wchar_t *path, wchar_t **abspath_p)
}
#ifdef MS_WINDOWS
- wchar_t woutbuf[MAX_PATH], *woutbufp = woutbuf;
- DWORD result;
-
- result = GetFullPathNameW(path,
- Py_ARRAY_LENGTH(woutbuf), woutbuf,
- NULL);
- if (!result) {
- return -1;
- }
-
- if (result >= Py_ARRAY_LENGTH(woutbuf)) {
- if ((size_t)result <= (size_t)PY_SSIZE_T_MAX / sizeof(wchar_t)) {
- woutbufp = PyMem_RawMalloc((size_t)result * sizeof(wchar_t));
- }
- else {
- woutbufp = NULL;
- }
- if (!woutbufp) {
- *abspath_p = NULL;
- return 0;
- }
-
- result = GetFullPathNameW(path, result, woutbufp, NULL);
- if (!result) {
- PyMem_RawFree(woutbufp);
- return -1;
- }
- }
-
- if (woutbufp != woutbuf) {
- *abspath_p = woutbufp;
- return 0;
- }
-
- *abspath_p = _PyMem_RawWcsdup(woutbufp);
- return 0;
+ return _PyOS_getfullpathname(path, abspath_p);
#else
wchar_t cwd[MAXPATHLEN + 1];
cwd[Py_ARRAY_LENGTH(cwd) - 1] = 0;
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 284cfac..8bcad67 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -20,6 +20,7 @@
#include "pycore_pyerrors.h" // _PyErr_Occurred()
#include "pycore_pylifecycle.h" // _PyErr_Print()
#include "pycore_pystate.h" // _PyThreadState_GET()
+#include "pycore_runtime_init.h" // _PyRuntimeState_INIT
#include "pycore_sliceobject.h" // _PySlice_Fini()
#include "pycore_structseq.h" // _PyStructSequence_InitState()
#include "pycore_sysmodule.h" // _PySys_ClearAuditHooks()
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");
}