summaryrefslogtreecommitdiff
path: root/Python/errors.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/errors.c b/Python/errors.c
index 9658afeb9f..1783084c33 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -218,6 +218,9 @@ PyErr_SetString(PyObject *exception, const char *string)
PyObject* _Py_HOT_FUNCTION
PyErr_Occurred(void)
{
+ /* The caller must hold the GIL. */
+ assert(PyGILState_Check());
+
PyThreadState *tstate = _PyThreadState_GET();
return _PyErr_Occurred(tstate);
}