Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asyncio.coroutine is deprecated in 3.8 #3776

Closed
tirkarthi opened this issue May 16, 2019 · 6 comments · Fixed by #4056
Closed

asyncio.coroutine is deprecated in 3.8 #3776

tirkarthi opened this issue May 16, 2019 · 6 comments · Fixed by #4056

Comments

@tirkarthi
Copy link

asyncio.coroutine decorator is deprecated with 3.8 and is used in some of the code. DeprecationWarnings could be fixed.

Upstream CPython PR : python/cpython#13346

@asvetlov
Copy link
Member

Actually, 2 places only: helpers.py and test_utils.py.
The fix should be easy: replacement @asyncio.coroutine with @types.coroutine is enough I hope.

Would you make a PR?

@tirkarthi
Copy link
Author

I grepped for 'asyncio.coroutine' in master branch and can see it's usage in many places. Am I missing something here?

$ rg 'asyncio.coroutine\b'
aiohttp/helpers.py
103:@asyncio.coroutine

aiohttp/test_utils.py
660:    @asyncio.coroutine

tests/test_tracing.py
148:        callback = Mock(side_effect=asyncio.coroutine(Mock()))

tests/test_web_functional.py
1759:    on_request_start = mock.Mock(side_effect=asyncio.coroutine(mock.Mock()))
1760:    on_request_end = mock.Mock(side_effect=asyncio.coroutine(mock.Mock()))
1762:        side_effect=asyncio.coroutine(mock.Mock()))
1764:        side_effect=asyncio.coroutine(mock.Mock()))
1765:    on_request_redirect = mock.Mock(side_effect=asyncio.coroutine(mock.Mock()))
1767:        side_effect=asyncio.coroutine(mock.Mock()))
1769:        side_effect=asyncio.coroutine(mock.Mock()))

tests/test_connector.py
735:        side_effect=asyncio.coroutine(mock.Mock())
738:        side_effect=asyncio.coroutine(mock.Mock())
741:        side_effect=asyncio.coroutine(mock.Mock())
744:        side_effect=asyncio.coroutine(mock.Mock())
811:        side_effect=asyncio.coroutine(mock.Mock())
814:        side_effect=asyncio.coroutine(mock.Mock())
885:        side_effect=asyncio.coroutine(mock.Mock())
888:        side_effect=asyncio.coroutine(mock.Mock())
1022:        side_effect=asyncio.coroutine(mock.Mock())
1025:        side_effect=asyncio.coroutine(mock.Mock())
1417:        side_effect=asyncio.coroutine(mock.Mock())
1420:        side_effect=asyncio.coroutine(mock.Mock())
1477:        side_effect=asyncio.coroutine(mock.Mock())

tests/test_proxy.py
227:        @asyncio.coroutine
278:        @asyncio.coroutine

tests/test_client_functional.py
2363:@asyncio.coroutine
2377:@asyncio.coroutine

tests/test_client_session.py
533:    on_request_start = mock.Mock(side_effect=asyncio.coroutine(mock.Mock()))
534:    on_request_redirect = mock.Mock(side_effect=asyncio.coroutine(mock.Mock()))
535:    on_request_end = mock.Mock(side_effect=asyncio.coroutine(mock.Mock()))
586:    on_request_end = mock.Mock(side_effect=asyncio.coroutine(mock.Mock()))
588:        side_effect=asyncio.coroutine(mock.Mock())

@asvetlov
Copy link
Member

I looked at aiohttp itself, not tests.
side_effect=asyncio.coroutine(mock.Mock()) can be replaced with side_effect=types.coroutine(mock.Mock()) I guess.
Others may be replaced with async def probably. Need to try though.

@webknjaz
Copy link
Member

FTR this fails in our tests in nightly Python env: https://travis-ci.com/aio-libs/aiohttp/jobs/207009011#L494

@Hanaasagi
Copy link
Member

If nobody is working on this, I am willing to do.

@webknjaz
Copy link
Member

@Hanaasagi sure, go ahead!

@Hanaasagi Hanaasagi mentioned this issue Sep 16, 2019
5 tasks
@helpr helpr bot added the pr-available label Sep 16, 2019
@helpr helpr bot added pr-merged and removed pr-available labels Sep 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants