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/tracemalloc.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/tracemalloc.c')
-rw-r--r-- | Python/tracemalloc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/tracemalloc.c b/Python/tracemalloc.c index 919c564..a9f45e5 100644 --- a/Python/tracemalloc.c +++ b/Python/tracemalloc.c @@ -367,7 +367,7 @@ traceback_new(void) traceback_t *traceback; _Py_hashtable_entry_t *entry; - assert(PyGILState_Check()); + _Py_AssertHoldsTstate(); /* get frames */ traceback = tracemalloc_traceback; @@ -749,7 +749,7 @@ static void tracemalloc_clear_traces_unlocked(void) { // Clearing tracemalloc_filenames requires the GIL to call Py_DECREF() - assert(PyGILState_Check()); + _Py_AssertHoldsTstate(); set_reentrant(1); @@ -1302,7 +1302,7 @@ PyTraceMalloc_Untrack(unsigned int domain, uintptr_t ptr) void _PyTraceMalloc_Fini(void) { - assert(PyGILState_Check()); + _Py_AssertHoldsTstate(); tracemalloc_deinit(); } @@ -1323,7 +1323,7 @@ _PyTraceMalloc_TraceRef(PyObject *op, PyRefTracerEvent event, return 0; } - assert(PyGILState_Check()); + _Py_AssertHoldsTstate(); TABLES_LOCK(); if (!tracemalloc_config.tracing) { |