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
|
@ -3073,14 +3073,14 @@ _Py_SetRefcnt(PyObject *ob, Py_ssize_t refcnt)
|
|||
}
|
||||
|
||||
int PyRefTracer_SetTracer(PyRefTracer tracer, void *data) {
|
||||
assert(PyGILState_Check());
|
||||
_Py_AssertHoldsTstate();
|
||||
_PyRuntime.ref_tracer.tracer_func = tracer;
|
||||
_PyRuntime.ref_tracer.tracer_data = data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyRefTracer PyRefTracer_GetTracer(void** data) {
|
||||
assert(PyGILState_Check());
|
||||
_Py_AssertHoldsTstate();
|
||||
if (data != NULL) {
|
||||
*data = _PyRuntime.ref_tracer.tracer_data;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue