mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-128360: Add _Py_AssertHoldsTstate
as assertion for holding a thread state (#128361)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
parent
c6b570e5e3
commit
4d0a6595a0
11 changed files with 48 additions and 32 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue