mirror of
https://github.com/python/cpython.git
synced 2025-09-18 22:50:26 +00:00
bpo-32591: Add native coroutine origin tracking (#5250)
* Add coro.cr_origin and sys.set_coroutine_origin_tracking_depth * Use coroutine origin information in the unawaited coroutine warning * Stop using set_coroutine_wrapper in asyncio debug mode * In BaseEventLoop.set_debug, enable debugging in the correct thread
This commit is contained in:
parent
1211c9a989
commit
fc2f407829
20 changed files with 485 additions and 100 deletions
|
@ -4387,6 +4387,21 @@ PyEval_SetTrace(Py_tracefunc func, PyObject *arg)
|
|||
|| (tstate->c_profilefunc != NULL));
|
||||
}
|
||||
|
||||
void
|
||||
_PyEval_SetCoroutineOriginTrackingDepth(int new_depth)
|
||||
{
|
||||
assert(new_depth >= 0);
|
||||
PyThreadState *tstate = PyThreadState_GET();
|
||||
tstate->coroutine_origin_tracking_depth = new_depth;
|
||||
}
|
||||
|
||||
int
|
||||
_PyEval_GetCoroutineOriginTrackingDepth(void)
|
||||
{
|
||||
PyThreadState *tstate = PyThreadState_GET();
|
||||
return tstate->coroutine_origin_tracking_depth;
|
||||
}
|
||||
|
||||
void
|
||||
_PyEval_SetCoroutineWrapper(PyObject *wrapper)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue