falconry / falcon

The no-magic web data plane API and microservices framework for Python developers, with a focus on reliability, correctness, and performance at scale.
https://falcon.readthedocs.io/en/stable/
Apache License 2.0
9.51k stars 937 forks source link

ImportError: cannot import name 'CoroWrapper' from 'asyncio.coroutines' in Python 3.11 #2120

Closed seratch closed 1 year ago

seratch commented 1 year ago

Hi there! I am a maintainer of the Python Slack SDKs, which support Falcon as one of third party web frameworks to run Slack apps. While running our tests with Python 3.11 (see https://github.com/slackapi/bolt-python/pull/751 for more details if necessary), I found that falcon/asgi/response.py raises ImportError with the latest major version. Here is the details of the error:

_______ ERROR collecting tests/adapter_tests_async/test_async_falcon.py ________
ImportError while importing test module '/home/runner/work/bolt-python/bolt-python/tests/adapter_tests_async/test_async_falcon.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/adapter_tests_async/test_async_falcon.py:11: in <module>
    from slack_bolt.adapter.falcon.async_resource import AsyncSlackAppResource
slack_bolt/adapter/falcon/async_resource.py:5: in <module>
    from falcon.asgi import Request, Response
/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/falcon/asgi/__init__.py:35: in <module>
    from .app import App
/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/falcon/asgi/app.py:46: in <module>
    from .response import Response
/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/falcon/asgi/response.py:17: in <module>
    from asyncio.coroutines import CoroWrapper  # type: ignore
E   ImportError: cannot import name 'CoroWrapper' from 'asyncio.coroutines' (/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/asyncio/coroutines.py)

I believe that above stacktrace should be helpful enough for you but let me know if you need more information on it.

vytas7 commented 1 year ago

Hi @seratch! This is already fixed in master, but not released yet... We ought to cut 4.0 ASAP but we're a bit stretched on resources atm.

vytas7 commented 1 year ago

Duplicates #2072

seratch commented 1 year ago

@vytas7 Thanks for your prompt reply! Also, it's great to know that the issue is already fixed in the latest revision. Look forward to checking if v4 works for us when it's out 👋

vytas7 commented 1 year ago

Resolved fixed