diff options
author | Victor Stinner <vstinner@python.org> | 2020-03-10 22:49:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-10 22:49:16 (GMT) |
commit | 4e53abb0f4773e1cce68a4f41ddbb43e74364c5f (patch) | |
tree | 355a5073945fa5045a4b1354f9468c589d6d9158 /Python/pystate.c | |
parent | 88f82b2b9ea3514359cb6e3218121f75334063ac (diff) | |
download | cpython-4e53abb0f4773e1cce68a4f41ddbb43e74364c5f.zip cpython-4e53abb0f4773e1cce68a4f41ddbb43e74364c5f.tar.gz cpython-4e53abb0f4773e1cce68a4f41ddbb43e74364c5f.tar.bz2 |
bpo-38631: _PyGILState_Init() returns PyStatus (GH-18908)
_PyGILState_Init() now returns PyStatus rather than calling
Py_FatalError() on failure.
Diffstat (limited to 'Python/pystate.c')
-rw-r--r-- | Python/pystate.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/pystate.c b/Python/pystate.c index a926e97..504f5f4 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -1147,7 +1147,7 @@ PyThreadState_IsCurrent(PyThreadState *tstate) /* Internal initialization/finalization functions called by Py_Initialize/Py_FinalizeEx */ -void +PyStatus _PyGILState_Init(PyThreadState *tstate) { /* must init with valid states */ @@ -1157,13 +1157,14 @@ _PyGILState_Init(PyThreadState *tstate) struct _gilstate_runtime_state *gilstate = &tstate->interp->runtime->gilstate; if (PyThread_tss_create(&gilstate->autoTSSkey) != 0) { - Py_FatalError("Could not allocate TSS entry"); + return _PyStatus_NO_MEMORY(); } gilstate->autoInterpreterState = tstate->interp; assert(PyThread_tss_get(&gilstate->autoTSSkey) == NULL); assert(tstate->gilstate_counter == 0); _PyGILState_NoteThreadState(gilstate, tstate); + return _PyStatus_OK(); } PyInterpreterState * |