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
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue