diff options
Diffstat (limited to 'Python/_warnings.c')
-rw-r--r-- | Python/_warnings.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c index dec6586..54fa5c5 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -1366,6 +1366,20 @@ exit: } void +_PyErr_WarnUnawaitedAgenMethod(PyAsyncGenObject *agen, PyObject *method) +{ + PyObject *exc = PyErr_GetRaisedException(); + if (_PyErr_WarnFormat((PyObject *)agen, PyExc_RuntimeWarning, 1, + "coroutine method %R of %R was never awaited", + method, agen->ag_qualname) < 0) + { + PyErr_WriteUnraisable((PyObject *)agen); + } + PyErr_SetRaisedException(exc); +} + + +void _PyErr_WarnUnawaitedCoroutine(PyObject *coro) { /* First, we attempt to funnel the warning through |