diff --git a/src/ZEO/asyncio/_futures.pyx b/src/ZEO/asyncio/_futures.pyx index 2e93d2ad..07f0947c 100644 --- a/src/ZEO/asyncio/_futures.pyx +++ b/src/ZEO/asyncio/_futures.pyx @@ -272,29 +272,11 @@ cdef class CoroutineExecutor: result._asyncio_future_blocking = False await_next = result + # bad await else: - # object with __await__ - e.g. @cython.iterable_coroutine used by uvloop - risawaitable = True - try: - rawait = result.__await__() - except AttributeError: - risawaitable = False - else: - # cython.iterable_coroutine returns `coroutine_wrapper` that mimics - # iterator/generator but does not inherit from types.GeneratorType . - await_next = AsyncTask(rawait, self.task.get_loop()) - - if not risawaitable: - # bare yield - if result is None: - await_next = Future(self.task.get_loop()) - await_next.set_result(None) - - # bad yield - else: - await_next = Future(self.task.get_loop()) - await_next.set_exception( - RuntimeError("Task got bad yield: %r" % (result,))) + await_next = Future(self.task.get_loop()) + await_next.set_exception( + RuntimeError("Task got bad await: %r" % (result,))) if self.cancel_requested: _cancel_future(await_next, self.cancel_msg) diff --git a/src/ZEO/asyncio/futures.py b/src/ZEO/asyncio/futures.py index 3af66300..5b0a0d55 100644 --- a/src/ZEO/asyncio/futures.py +++ b/src/ZEO/asyncio/futures.py @@ -253,29 +253,11 @@ def step(self): result._asyncio_future_blocking = False await_next = result + # bad await else: - # object with __await__ - e.g. @cython.iterable_coroutine used by uvloop - risawaitable = True - try: - rawait = result.__await__() - except AttributeError: - risawaitable = False - else: - # cython.iterable_coroutine returns `coroutine_wrapper` that mimics - # iterator/generator but does not inherit from types.GeneratorType . - await_next = AsyncTask(rawait, self.task.get_loop()) - - if not risawaitable: - # bare yield - if result is None: - await_next = Future(self.task.get_loop()) - await_next.set_result(None) - - # bad yield - else: - await_next = Future(self.task.get_loop()) - await_next.set_exception( - RuntimeError("Task got bad yield: %r" % (result,))) + await_next = Future(self.task.get_loop()) + await_next.set_exception( + RuntimeError("Task got bad await: %r" % (result,))) if self.cancel_requested: _cancel_future(await_next, self.cancel_msg)