diff options
author | Victor Stinner <vstinner@python.org> | 2019-11-07 11:42:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-07 11:42:07 (GMT) |
commit | d12d0e7c0fe2b49c40ac4d66365147c619d6c475 (patch) | |
tree | 9ccd0a4fdb77f4c9ee169c9f775eab2de78bffd0 /Include | |
parent | 991b02dc871e101e98edece37d8a570f6a39d79f (diff) | |
download | cpython-d12d0e7c0fe2b49c40ac4d66365147c619d6c475.zip cpython-d12d0e7c0fe2b49c40ac4d66365147c619d6c475.tar.gz cpython-d12d0e7c0fe2b49c40ac4d66365147c619d6c475.tar.bz2 |
bpo-38733: PyErr_Occurred() caller must hold the GIL (GH-17080)
bpo-3605, bpo-38733: Optimize _PyErr_Occurred(): remove "tstate ==
NULL" test.
Py_FatalError() no longer calls PyErr_Occurred() if called without
holding the GIL. So PyErr_Occurred() no longer has to support
tstate==NULL case.
_Py_CheckFunctionResult(): use directly _PyErr_Occurred() to avoid
explicit "!= NULL" test.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/internal/pycore_pyerrors.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Include/internal/pycore_pyerrors.h b/Include/internal/pycore_pyerrors.h index edbfdfa..f3aa3e8 100644 --- a/Include/internal/pycore_pyerrors.h +++ b/Include/internal/pycore_pyerrors.h @@ -10,7 +10,8 @@ extern "C" { static inline PyObject* _PyErr_Occurred(PyThreadState *tstate) { - return tstate == NULL ? NULL : tstate->curexc_type; + assert(tstate != NULL); + return tstate->curexc_type; } |