diff options
author | Nathaniel J. Smith <njs@pobox.com> | 2018-01-21 06:44:07 -0800 |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2018-01-21 09:44:07 -0500 |
commit | fc2f407829d9817ddacccae6944dd0879cfaca24 (patch) | |
tree | 1775a28a8181975363798f9b3e7cb2bb100e49a2 /Python/ceval.c | |
parent | 1211c9a9897a174b7261ca258cabf289815a40d8 (diff) | |
download | cpython-git-fc2f407829d9817ddacccae6944dd0879cfaca24.tar.gz |
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
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 9276755f0d..2b7c0c8024 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4388,6 +4388,21 @@ PyEval_SetTrace(Py_tracefunc func, PyObject *arg) } 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) { PyThreadState *tstate = PyThreadState_GET(); |