bpo-38631: _PyGILState_Init() returns PyStatus (GH-18908)
_PyGILState_Init() now returns PyStatus rather than calling
Py_FatalError() on failure.
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index d00bf82..bc32eff 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -551,7 +551,10 @@
_PyEval_FiniThreads(&runtime->ceval);
/* Auto-thread-state API */
- _PyGILState_Init(tstate);
+ status = _PyGILState_Init(tstate);
+ if (_PyStatus_EXCEPTION(status)) {
+ return status;
+ }
/* Create the GIL */
status = _PyEval_InitThreads(tstate);