From 3026cad59b87751a9215111776cac8e819458fce Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 1 Jun 2020 16:02:40 +0200 Subject: bpo-40826: Add _Py_EnsureTstateNotNULL() macro (GH-20571) Add _Py_EnsureTstateNotNULL(tstate) macro: call Py_FatalError() if tstate is NULL, the error message contains the current function name. --- Python/sysmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Python/sysmodule.c') diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 914beb7e127..e3fe1436145 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -457,7 +457,7 @@ static PyObject * sys_audit(PyObject *self, PyObject *const *args, Py_ssize_t argc) { PyThreadState *tstate = _PyThreadState_GET(); - assert(tstate != NULL); + _Py_EnsureTstateNotNULL(tstate); if (argc == 0) { _PyErr_SetString(tstate, PyExc_TypeError, -- cgit v1.2.3