-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
Breaking API Change in Python 3.13.3: Task Factory Signature Change #133745
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
(I'm marking it as release-blocker just so that we can find the issue more easily) |
I suppose that the following issue in the toga project is related to this:
There is already a commit to work around the issue. |
@asvetlov @kumaraditya303 @graingert for 3.13, do you want to propose anything other than a rollback of the relevant PR (and anything that depends on it)? We'll probably want to do a new release to fix the breakage. For 3.14 it may also be worth considering not breaking the documented API (/cc @hugovk), but we have a bit more time to get that sorted. |
No hurry. 3.13.3 was released a month ago, and only now we found out about that breakage. A few more days is not critical. |
Other breakage of that documented contract happened in 3.11 (bpo-46994/#91150). I encountered a similar problem in #74696. It was needed to pass additional argument to the user registered function. I solved it by testing the optional We could do the same here. The users which need to pass the name to the constructor (eager tasks) should set a special attribute of the factory. By default, the old method will be used. We should document that this is temporary, and the factory should support arbitrary keyword arguments. |
I created #133808 to revert the breaking change for 3.13. |
In PR #128768 (gh-128308), the asyncio task factory signature was changed from
(loop, coro, context=None)
to(loop, coro, **kwargs)
. This seemingly minor change breaks backward compatibility for existing task factory implementations.The documentation was updated to reflect this new contract:
(loop, coro, context=None)
, where the callable must return aasyncio.Future
-compatible object.(loop, coro, **kwargs)
, where the callable must pass on all *kwargs, and return aasyncio.Task
-compatible object.This change causes runtime errors for any code with task factories implemented according to the previous contract, as these factories now unexpectedly receive keyword arguments like
name
that they aren't designed to handle.Reproducer
This prints:
This is a breaking change introduced in a patch release, which violates our versioning policy. The change was intended to support the
name
keyword argument for eager tasks, but the implementation method has unintentionally broken existing code that followed the previously documented API contract.CPython versions tested on:
3.14
Operating systems tested on:
Linux
Linked PRs
The text was updated successfully, but these errors were encountered: