Tinche / aiofiles

File support for asyncio
Apache License 2.0
2.67k stars 149 forks source link

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

Closed devdjdjdj closed 3 years ago

devdjdjdj commented 4 years ago

I get this warning when I run my code

/python3.8/site-packages/aiofiles/os.py:10: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def run(*args, loop=None, executor=None, **kwargs):

ewen-lbh commented 4 years ago

I tried to remove the @asyncio.coroutine line and add an async keyword in front of def and it worked without any problems (for my test case at least), see the following diff

  def wrap(func):
-     @asyncio.coroutine
      @wraps(func)
-     def run(*args, loop=None, executor=None, **kwargs):
+     async def run(*args, loop=None, executor=None, **kwargs):
samuelcolvin commented 3 years ago

this can be closed v0.6 is released.