From 4d0a6595a06c554c57ebd90ee64ff4c2bec239b8 Mon Sep 17 00:00:00 2001 From: Peter Bierma Date: Mon, 20 Jan 2025 06:34:35 -0500 Subject: gh-128360: Add `_Py_AssertHoldsTstate` as assertion for holding a thread state (#128361) Co-authored-by: Kumar Aditya --- Python/legacy_tracing.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Python/legacy_tracing.c') diff --git a/Python/legacy_tracing.c b/Python/legacy_tracing.c index 45af275f1f6..97634f9183c 100644 --- a/Python/legacy_tracing.c +++ b/Python/legacy_tracing.c @@ -491,8 +491,8 @@ int _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg) { assert(is_tstate_valid(tstate)); - /* The caller must hold the GIL */ - assert(PyGILState_Check()); + /* The caller must hold a thread state */ + _Py_AssertHoldsTstate(); /* Call _PySys_Audit() in the context of the current thread state, even if tstate is not the current thread state. */ @@ -586,8 +586,8 @@ int _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg) { assert(is_tstate_valid(tstate)); - /* The caller must hold the GIL */ - assert(PyGILState_Check()); + /* The caller must hold a thread state */ + _Py_AssertHoldsTstate(); /* Call _PySys_Audit() in the context of the current thread state, even if tstate is not the current thread state. */ -- cgit v1.2.3