diff options
author | Peter Bierma <zintensitydev@gmail.com> | 2025-01-20 11:34:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-20 11:34:35 (GMT) |
commit | 4d0a6595a06c554c57ebd90ee64ff4c2bec239b8 (patch) | |
tree | a44951c47b86cbc327cdd5e1a588b467dc758a36 /Python/errors.c | |
parent | c6b570e5e3b214d2038645c5fa7806e0fb3f7dcd (diff) | |
download | cpython-4d0a6595a06c554c57ebd90ee64ff4c2bec239b8.zip cpython-4d0a6595a06c554c57ebd90ee64ff4c2bec239b8.tar.gz cpython-4d0a6595a06c554c57ebd90ee64ff4c2bec239b8.tar.bz2 |
gh-128360: Add `_Py_AssertHoldsTstate` as assertion for holding a thread state (#128361)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Diffstat (limited to 'Python/errors.c')
-rw-r--r-- | Python/errors.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/errors.c b/Python/errors.c index b6ac2f7..9c7b771 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -314,8 +314,8 @@ _PyErr_SetLocaleString(PyObject *exception, const char *string) PyObject* _Py_HOT_FUNCTION PyErr_Occurred(void) { - /* The caller must hold the GIL. */ - assert(PyGILState_Check()); + /* The caller must hold a thread state. */ + _Py_AssertHoldsTstate(); PyThreadState *tstate = _PyThreadState_GET(); return _PyErr_Occurred(tstate); |