diff options
author | Nathaniel J. Smith <njs@pobox.com> | 2018-01-21 14:44:07 (GMT) |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2018-01-21 14:44:07 (GMT) |
commit | fc2f407829d9817ddacccae6944dd0879cfaca24 (patch) | |
tree | 1775a28a8181975363798f9b3e7cb2bb100e49a2 /Include | |
parent | 1211c9a9897a174b7261ca258cabf289815a40d8 (diff) | |
download | cpython-fc2f407829d9817ddacccae6944dd0879cfaca24.zip cpython-fc2f407829d9817ddacccae6944dd0879cfaca24.tar.gz cpython-fc2f407829d9817ddacccae6944dd0879cfaca24.tar.bz2 |
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 'Include')
-rw-r--r-- | Include/ceval.h | 2 | ||||
-rw-r--r-- | Include/genobject.h | 1 | ||||
-rw-r--r-- | Include/pystate.h | 2 | ||||
-rw-r--r-- | Include/warnings.h | 4 |
4 files changed, 9 insertions, 0 deletions
diff --git a/Include/ceval.h b/Include/ceval.h index 70306b8..bce8a0b 100644 --- a/Include/ceval.h +++ b/Include/ceval.h @@ -31,6 +31,8 @@ PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj, #ifndef Py_LIMITED_API PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *); PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *); +PyAPI_FUNC(void) _PyEval_SetCoroutineOriginTrackingDepth(int new_depth); +PyAPI_FUNC(int) _PyEval_GetCoroutineOriginTrackingDepth(void); PyAPI_FUNC(void) _PyEval_SetCoroutineWrapper(PyObject *); PyAPI_FUNC(PyObject *) _PyEval_GetCoroutineWrapper(void); PyAPI_FUNC(void) _PyEval_SetAsyncGenFirstiter(PyObject *); diff --git a/Include/genobject.h b/Include/genobject.h index 87fbe17..16b9833 100644 --- a/Include/genobject.h +++ b/Include/genobject.h @@ -51,6 +51,7 @@ PyAPI_FUNC(void) _PyGen_Finalize(PyObject *self); #ifndef Py_LIMITED_API typedef struct { _PyGenObject_HEAD(cr) + PyObject *cr_origin; } PyCoroObject; PyAPI_DATA(PyTypeObject) PyCoro_Type; diff --git a/Include/pystate.h b/Include/pystate.h index a481528..5a69e14 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -262,6 +262,8 @@ typedef struct _ts { void (*on_delete)(void *); void *on_delete_data; + int coroutine_origin_tracking_depth; + PyObject *coroutine_wrapper; int in_coroutine_wrapper; diff --git a/Include/warnings.h b/Include/warnings.h index a3f83ff..a675bb5 100644 --- a/Include/warnings.h +++ b/Include/warnings.h @@ -56,6 +56,10 @@ PyErr_WarnExplicitFormat(PyObject *category, #define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1) #endif +#ifndef Py_LIMITED_API +void _PyErr_WarnUnawaitedCoroutine(PyObject *coro); +#endif + #ifdef __cplusplus } #endif |