mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
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
This commit is contained in:
parent
91b59a3fcd
commit
8262c96bcc
3 changed files with 7 additions and 10 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue