-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
AttributeError: 'Task' object has no attribute 'uncancel'. Did you mean: 'cancel'?
when the asyncio loop.set_task_factory
factory returns a asyncio.Future
-compatible object
#95097
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
Comments
AttributeError: 'Task' object has no attribute 'uncancel'. Did you mean: 'cancel'?
when the asyncio loop.set_task_factory factory returns a asyncio.Future-compatible objectAttributeError: 'Task' object has no attribute 'uncancel'. Did you mean: 'cancel'?
when the asyncio loop.set_task_factory
factory returns a asyncio.Future
-compatible object
@pablogsal @Fidget-Spinner tagging this is a release blocker for 3.11 |
A short summary of the issue and why it's a release blocker: asyncio in 3.11 now calls |
Strictly, it is not a backwards incompatible change, The docs mentions that "The callable must return a asyncio.Future-compatible object." so if the Task interface changes then you have to adapt your code to allow duck typing to work. See Yury's opinion on a similar issue #84979 (comment). IMO a whatsnew entry would be sufficient here on porting to 3.11. |
Unfortunately, that's not what backwards compatibility is defined. The interface itself changing is backwards incompatible if existing APIs now fail due to extra parameters added. This would be fine if the interface changes to add a new parameter that's defaulted to something and existing interfaces keep doing what they were doing but new ones don't. If I understand correctly, this makes existing subclasses fail with existing asyncio APIs, which is itself backwards incompatible. |
Here's the original opinion that influenced #8547 (comment) (the link might not work on mobile you have to click "load more" to expand 42 hidden items) |
This should be fixed ASAP, because beta5 is tomorrow and we don't really want to delay this one. |
Unfortunately, there are multiple new APIs like taskgroups and the timeout context manager which depend on the new |
The PR #95098 will break taskgroups and timeout context manager on third party task factories as it skips the calling the |
New APIs that don't work without new stuff is ok. Old APIs that now don't work without the new stuff is not ok |
it doesn't break it - it just allows the CancelledError to propagate, which is the old api |
I'll work on a PR to unblock 3.11 release with minimal changes as Pablo advised #95097 (comment) |
See #95211 |
…pythonGH-95211) Co-authored-by: Thomas Grainger <tagrain@gmail.com> (cherry picked from commit 54f4884) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
This is fixed in 3.11 and 3.12. Thanks, Thomas! ✨ 🍰 ✨ |
Thanks, Kumar, too! |
Bug report
https://docs.python.org/3.11/library/asyncio-eventloop.html#asyncio.loop.set_task_factory is documented as: "The callable must return a asyncio.Future-compatible object." however a number of apis now assume tasks have an
uncancel()
method:results in:
Your environment
The text was updated successfully, but these errors were encountered: