Scrapy, a fast high-level web crawling & scraping framework for Python.
Add a cast to deferred_from_coro, that code path has different typing.
Andrey Rakhmatullinfa9897282fc5
diff --git a/scrapy/utils/defer.py b/scrapy/utils/defer.pyindex a3bd273e3..d25ebbdf4 100644--- a/scrapy/utils/defer.py+++ b/scrapy/utils/defer.py@@ -288,7 +288,7 @@ def deferred_from_coro(o) -> Any:if not is_asyncio_reactor_installed():# wrapping the coroutine directly into a Deferred, this doesn't work correctly with coroutines# that use asyncio, e.g. "await asyncio.sleep(1)"- return ensureDeferred(o)+ return ensureDeferred(cast(Coroutine[Deferred, Any, Any], o))# wrapping the coroutine into a Future and then into a Deferred, this requires AsyncioSelectorReactorevent_loop = _get_asyncio_event_loop()return Deferred.fromFuture(asyncio.ensure_future(o, loop=event_loop))