.. c:function:: void PyEval_AcquireThread(PyThreadState *tstate)
Acquire the global interpreter lock and set the current thread state to
- *tstate*, which should not be ``NULL``. The lock must have been created earlier.
+ *tstate*, which must not be ``NULL``. The lock must have been created earlier.
If this thread already has the lock, deadlock ensues.
.. note::
void
PyEval_AcquireThread(PyThreadState *tstate)
{
- if (tstate == NULL) {
- Py_FatalError("PyEval_AcquireThread: NULL new thread state");
- }
+ assert(tstate != NULL);
_PyRuntimeState *runtime = tstate->interp->runtime;
struct _ceval_runtime_state *ceval = &runtime->ceval;
void
PyEval_ReleaseThread(PyThreadState *tstate)
{
- if (tstate == NULL) {
- Py_FatalError("PyEval_ReleaseThread: NULL thread state");
- }
+ assert(tstate != NULL);
_PyRuntimeState *runtime = tstate->interp->runtime;
PyThreadState *new_tstate = _PyThreadState_Swap(&runtime->gilstate, NULL);
void
PyEval_RestoreThread(PyThreadState *tstate)
{
+ assert(tstate != NULL);
+
_PyRuntimeState *runtime = tstate->interp->runtime;
struct _ceval_runtime_state *ceval = &runtime->ceval;
-
- if (tstate == NULL) {
- Py_FatalError("PyEval_RestoreThread: NULL tstate");
- }
assert(gil_created(&ceval->gil));
int err = errno;