Commit 1baac19e authored by Stefan Behnel's avatar Stefan Behnel

Do not issue 'never awaited' warning for generators (only for coroutines).

parent 2eeaa2c7
...@@ -1067,6 +1067,12 @@ static void __Pyx_Coroutine_del(PyObject *self) { ...@@ -1067,6 +1067,12 @@ static void __Pyx_Coroutine_del(PyObject *self) {
#endif #endif
if (unlikely(gen->resume_label == 0 && !error_value)) { if (unlikely(gen->resume_label == 0 && !error_value)) {
#ifdef __Pyx_Coroutine_USED
#ifdef __Pyx_Generator_USED
// only warn about (async) coroutines
if (!__Pyx_Generator_CheckExact(self))
#endif
{
// untrack dead object as we are executing Python code (which might trigger GC) // untrack dead object as we are executing Python code (which might trigger GC)
PyObject_GC_UnTrack(self); PyObject_GC_UnTrack(self);
#if PY_VERSION_HEX >= 0x03030000 || defined(PyErr_WarnFormat) #if PY_VERSION_HEX >= 0x03030000 || defined(PyErr_WarnFormat)
...@@ -1117,6 +1123,8 @@ static void __Pyx_Coroutine_del(PyObject *self) { ...@@ -1117,6 +1123,8 @@ static void __Pyx_Coroutine_del(PyObject *self) {
Py_XDECREF(msg);} Py_XDECREF(msg);}
#endif #endif
PyObject_GC_Track(self); PyObject_GC_Track(self);
}
#endif /*__Pyx_Coroutine_USED*/
} else { } else {
PyObject *res = __Pyx_Coroutine_Close(self); PyObject *res = __Pyx_Coroutine_Close(self);
if (unlikely(!res)) { if (unlikely(!res)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment