Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

graingert
Copy link
Contributor

@graingertgraingert commentedMay 12, 2025
edited
Loading

@graingertgraingert changed the titlegh-128308: Fix asyncio task factory name/context kwarg breaksgh-133745: Fix asyncio task factory name/context kwarg breaksMay 12, 2025
@graingertgraingertforce-pushed thefix-name-passed-to-task-factory branch fromf298146 to5c3c953CompareMay 12, 2025 19:13
@graingertgraingert changed the titlegh-133745: Fix asyncio task factory name/context kwarg breaks[3.13] gh-133745: Fix asyncio task factory name/context kwarg breaksMay 12, 2025
Copy link
Member

@gvanrossumgvanrossum left a 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).

Copy link
Member

@gvanrossumgvanrossum left a 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 happeninstead of the rollback, right?

@graingert
Copy link
ContributorAuthor

To be clear, this is supposed to happeninstead of the rollback, right?

that's my understanding, yet

Copy link
Member

@gvanrossumgvanrossum left a 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?

@graingert
Copy link
ContributorAuthor

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

gvanrossum reacted with thumbs up emoji

@gvanrossum
Copy link
Member

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:

In 3.13.3 we accidentally changed the signature of create_task() 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. In particular, the special-casing ofname andcontext is back (until 3.14) and consequently eager tasks may still find that their name hasn't been set before they execute their first line of code.

WDYT? If you agree, let's merge this.

@graingertgraingert marked this pull request as ready for reviewMay 14, 2025 08:16
Copy link
Member

@gvanrossumgvanrossum left a 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.

Copy link
Contributor

@kumaraditya303kumaraditya303 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM,@graingert do you want to add the version changed entry?

@@ -238,18 +238,31 @@ Creating Tasks

-----------------------------------------------

.. function:: create_task(coro, *, name=None, context=None)
.. function:: create_task(coro, *, name=None, context=None, eager_start=None, **kwargs)
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

oh hang on these didn't change until 3.14

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Comment on lines 379 to 385
An optional keyword-only *eager_start* argument allows eagerly starting
the execution of the :class:`asyncio.Task` at task creation time.
If set to ``True`` and the event loop is running, the task will start
executing the coroutine immediately, until the first time the coroutine
blocks. If the coroutine returns or raises without blocking, the task
will be finished eagerly and will skip scheduling to the event loop.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I don't believe we should documenteager_start here at all. I doesn't require special treatment, it can just be put in**kwargs. It looks like we added this in 3.13.4, and such feature changes in a bugfix release are frowned upon. We should only advertise**kwargs as an unfortunate added in3.13.3 and fixed in 3.13.4.

Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Copy link
Member

@gvanrossumgvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Everything looks great! I will merge this now.

@gvanrossumgvanrossum merged commitfd6a602 intopython:3.13May 18, 2025
39 checks passed
@gvanrossum
Copy link
Member

Thanks Thomas for moving this forward! Hopefully this is the end of the story for 3.13. For 3.14 I think we ought to add a bit to whatsnew/3.14.rst.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@gvanrossumgvanrossumgvanrossum approved these changes

@kumaraditya303kumaraditya303kumaraditya303 approved these changes

@1st11st1Awaiting requested review from 1st11st1 is a code owner

@asvetlovasvetlovAwaiting requested review from asvetlovasvetlov is a code owner

@willingcwillingcAwaiting requested review from willingcwillingc is a code owner

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@graingert@gvanrossum@kumaraditya303

[8]ページ先頭

©2009-2025 Movatter.jp