summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2021-12-07 21:02:17 (GMT)
committerGitHub <noreply@github.com>2021-12-07 21:02:17 (GMT)
commit8262c96bcc1841188866c1b022d9087e89639d98 (patch)
tree7f57ca54cf571b95c5fe175fdc7456bbba28b667 /Python/ceval.c
parent91b59a3fcdcb93d74bb89cce536f11d2990f655d (diff)
downloadcpython-8262c96bcc1841188866c1b022d9087e89639d98.zip
cpython-8262c96bcc1841188866c1b022d9087e89639d98.tar.gz
cpython-8262c96bcc1841188866c1b022d9087e89639d98.tar.bz2
bpo-46008: Return void from _PyEval_InitState(). (gh-29970)
This falls into the category of keep-allocation-and-initialization separate. It also allows us to use _PyEval_InitState() safely in functions that return void. https://bugs.python.org/issue46008
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index c22af02..36d1360 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -747,24 +747,19 @@ _PyEval_InitRuntimeState(struct _ceval_runtime_state *ceval)
#endif
}
-int
-_PyEval_InitState(struct _ceval_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);
- pending->lock = PyThread_allocate_lock();
- if (pending->lock == NULL) {
- return -1;
- }
+ pending->lock = pending_lock;
#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
_gil_initialize(&ceval->gil);
#endif
-
- return 0;
}
void