You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
support for Awaitable objects in asyncio.wait removed in 3.11 #95601
asyncio.iscoroutine(ExampleAwaitable())=False
Traceback (most recent call last):
File "/home/graingert/projects/foo.py", line 17, in <module>
asyncio.run(amain())
File "/usr/lib/python3.11/asyncio/runners.py", line 187, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/runners.py", line 120, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/base_events.py", line 650, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/graingert/projects/foo.py", line 14, in amain
await asyncio.wait([ExampleAwaitable()])
File "/usr/lib/python3.11/asyncio/tasks.py", line 427, in wait
return await _wait(fs, timeout, return_when, loop)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/tasks.py", line 531, in _wait
f.add_done_callback(_on_completion)
^^^^^^^^^^^^^^^^^^^
AttributeError: 'ExampleAwaitable' object has no attribute 'add_done_callback'
this broke distributed and we missed the DeprecationWarning because ensure_future accepts a wider variety of objects than just futures tasks and coroutines
changed the title [-]support for Awaitable objects in `asyncio.wait_for` removed in 3.11[/-][+]support for Awaitable objects in `asyncio.wait` removed in 3.11[/+]on Aug 3, 2022
So what is the bug exactly? Was the deprecation schedule not followed properly? Or do you just disagree with the deprecation and subsequent removal? In that case, tough luck. The release manager isn't going to allow the removal to be reversed.
So what is the bug exactly? Was the deprecation schedule not followed properly? Or do you just disagree with the deprecation and subsequent removal? In that case, tough luck. The release manager isn't going to allow the removal to be reversed.
The deprecation schedule was not followed properly. The removal didn't match the deprecation, and support for iterables was removed. There's more discussion on the PR
Activity
graingert commentedon Aug 3, 2022
I think using something like this might help?
[-]support for Awaitable objects in `asyncio.wait_for` removed in 3.11[/-][+]support for Awaitable objects in `asyncio.wait` removed in 3.11[/+]pythongh-95601: forbid non-futures in asyncio.wait
graingert commentedon Aug 9, 2022
This was intended to be deprecated in 3.10 so I'm tentatively adding the 3.10 label
gvanrossum commentedon Aug 27, 2022
So what is the bug exactly? Was the deprecation schedule not followed properly? Or do you just disagree with the deprecation and subsequent removal? In that case, tough luck. The release manager isn't going to allow the removal to be reversed.
graingert commentedon Sep 12, 2022
The deprecation schedule was not followed properly. The removal didn't match the deprecation, and support for iterables was removed. There's more discussion on the PR
gvanrossum commentedon Oct 27, 2022
Now that the PR is closed, can you come up with a better description? It should describe a desired course of action.
daskGH-6785: asyncio.wait no longer calls ensure_future
daskGH-6785: asyncio.wait no longer calls ensure_future
daskGH-6785: asyncio.wait no longer calls ensure_future
daskGH-6785: asyncio.wait no longer calls ensure_future
daskGH-6785: asyncio.wait no longer calls ensure_future
sileht commentedon Nov 23, 2022
I upgrade some projects to 3.11 and got the same issue.
We usually fix python deprecation warning the day python released a version, but we missed that one.
The real root cause issue, I guess, is that the deprecation warning of python < 3.11 was not working for this kind of object:
daskGH-6785: asyncio.wait no longer calls ensure_future
daskGH-6785: asyncio.wait no longer calls ensure_future
Add support for Python 3.11 (#7249)
kumaraditya303 commentedon Apr 16, 2023
@graingert are you going to follow up on this? If not I am inclined to just close it, 3.11 is far ahead in release cycle now anyways.
kumaraditya303 commentedon Apr 23, 2023
Closing because of no response to my and Guido's comment.