terricain / aioboto3

Wrapper to use boto3 resources with the aiobotocore async backend
Apache License 2.0
719 stars 74 forks source link

Wrap coroutine objects in a task prior to calling wait. #257

Closed noblepayne closed 2 years ago

noblepayne commented 2 years ago

When running tests with newer versions of python, both in this project and in downstream consumers, the following warning is shown:

tests/test_s3.py::test_s3_copy_from
/some/path/src/aioboto3/aioboto3/s3/inject.py:296: DeprecationWarning: The explicit passing of coroutine objects to asyncio.wait() is deprecated since Python 3.8, and scheduled for removal in Python 3.11.
    _, pending = await asyncio.wait({io_queue.join(), exception_event.wait()}, return_when=asyncio.FIRST_COMPLETED)

To avoid issues with 3.11 and to remove this warning, this change wraps coroutine objects in a task prior to passing it to wait, as suggested by the stdlib docs.

Hope this is useful, and thanks for all the work on aioboto!

terricain commented 2 years ago

Oh nice spot, thanks :)