Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

"@coroutine" decorator is deprecated since Python 3.8 #648

Closed
youngminz opened this issue Oct 15, 2019 · 8 comments
Closed

"@coroutine" decorator is deprecated since Python 3.8 #648

youngminz opened this issue Oct 15, 2019 · 8 comments

Comments

@youngminz
Copy link
Contributor

youngminz commented Oct 15, 2019

When I test my program using aioredis==1.3.0 with pytest in Python 3.8.0, I get the following warning:

=============================== warnings summary ===============================
/.../lib/python3.8/site-packages/aioredis/abc.py:35
  /.../lib/python3.8/site-packages/aioredis/abc.py:35: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def wait_closed(self):

/.../lib/python3.8/site-packages/aioredis/abc.py:96
  /.../lib/python3.8/site-packages/aioredis/abc.py:96: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def acquire(self):  # TODO: arguments

/.../lib/python3.8/site-packages/aioredis/abc.py:133
  /.../lib/python3.8/site-packages/aioredis/abc.py:133: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def get(self):

-- Docs: https://docs.pytest.org/en/latest/warnings.html

Since Python 3.5+ supported by the aioredis supports the async def keyword, it seems to be fine to change the @asyncio.coroutine decorator to async def.

Python 3.5 Documentation:

The async def type of coroutine was added in Python 3.5, and is recommended if there is no need to support older Python versions.

@youngminz
Copy link
Contributor Author

loop parameter is deprecated too. It's better to get rid of this together.

DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.

@youngminz
Copy link
Contributor Author

The loop parameter is so heavily used throughout the test that finding and removing it from the test can be a huge task.

image

Also, the @pytest.mark.run_loop decorators that make up the event loop seem to need modification. I haven't looked at it in detail, but @pytest.mark.run_loop seems to be incompatible with the asyncio.get_event_loop() function. I will check for any changes that require further changes.

@popravich
Copy link
Contributor

Hi, @youngminz , no problem at all, please finish the coroutine PR and after that we can remove loop step-by-step, first from main code, then from tests, fixtures, etc.

@youngminz
Copy link
Contributor Author

Ok, I got it!

@popravich popravich mentioned this issue Nov 19, 2019
5 tasks
@l1n
Copy link

l1n commented Nov 26, 2019

I see that the feature branch has been merged, is it possible to do a release now?

@popravich
Copy link
Contributor

I'm preparing release, will make it in 4-8 hours

@popravich
Copy link
Contributor

Sorry, guys, another busy day, need some more time.

@popravich
Copy link
Contributor

v1.3.1 is out there!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants