-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
[3.13] gh-133745: Fix asyncio task factory name/context kwarg breaks #133948
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
base: 3.13
Are you sure you want to change the base?
Conversation
graingert
commented
May 12, 2025
•
edited
Loading
edited
- Issue: Breaking API Change in Python 3.13.3: Task Factory Signature Change #133745
f298146
to
5c3c953
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the right thing, just one refactoring suggestion.
We should ask Alice to try this (maybe after it's in the nightly builds).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be clear, this is supposed to happen instead of the rollback, right?
that's my understanding, yet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Despite what the comment says, you're just removing the try/except here. Was that intentional?
Ah it looks like that in the diff, but I also added an else and removed the early return. Execution follows after the if/else and returns the task deleting it 'after' the return |
Got it. What's difficult or controversial about the news fragment? Just that we're waffling about the feature? I think it's reasonable to say something like this:
WDYT? If you agree, let's merge this. |
Misc/NEWS.d/next/Library/2025-05-14-08-13-08.gh-issue-133745.rjgJkH.rst
Outdated
Show resolved
Hide resolved
@@ -0,0 +1 @@ | |||
In 3.13.3 we accidentally changed the signature of the asyncio ``create_task()`` family of methods and how it calls a custom task factory in a backwards incompatible way. Since some 3rd party libraries have already made changes to work around the issue that might break if we simply reverted the changes, we're instead changing things to be backwards compatible with 3.13.2 while still supporting those workarounds for 3.13.3. In particular, the special-casing of ``name`` and ``context`` is back (until 3.14) and consequently eager tasks may still find that their name hasn't been set before they execute their first yielding await. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to say create_task()
family of methods or just list out them all: loop.create_task
, TaskGroup.create_task
and asyncio.create_task
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no strong reason to spell them all out -- the 3.13.3 changes affect all methods named create_task and only those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am happy with the code and the news blurb.
I'd like @kumaraditya303 to review this too, to be extra sure that we don't have to backtrack more in 3.13.5.
And don't we need something in the docs about this change? I just noticed that it looks like the previous change didn't even have a versionchanged (3.13.3) directive. We should add that retroactively, and another versionchanged (3.13.4) mentioning what we changed there.