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.
This commit is contained in:
Victor Stinner 2020-06-01 16:02:40 +02:00 committed by GitHub
parent db64f12e4d
commit 3026cad59b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 31 deletions

View file

@ -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,