Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEP 789: Preventing task-cancellation bugs by limiting yield in async generators #3782

Merged
merged 17 commits into from
Jun 4, 2024

Conversation

Zac-HD
Copy link
Contributor

@Zac-HD Zac-HD commented May 15, 2024

I had so much fun working on PEP-678 that I'm back again, this time with a proposal to mitigate an extremely nasty interaction between async generators and 'cancel scope' context managers (such as asyncio.timeout and asyncio.TaskGroup).

It's co-authored with @njsmith based on this discuss thread, and I'm aiming to discuss this at the language summit I'm posting this draft despite a few open questions and placeholders for a worked example.

and... if it's not too cheeky, can I ask @python/pep-editors to grant this PEP number 789? It'd be a cute sequel to my last 馃榿
(huh, that's the tag suggested in PEP 1, but it's not hyperlinked. @JelleZijlstra then?)


馃摎 Documentation preview 馃摎: https://pep-previews--3782.org.readthedocs.build/pep-0789/

@Zac-HD Zac-HD requested a review from a team as a code owner May 15, 2024 03:12
@Rosuav
Copy link
Contributor

Rosuav commented May 15, 2024

Hmm, the docs build failed, but the output is quite hard to read. The actual error is hidden away and you have to scroll to the right to fix it - but there's no scroll bar. This is really an infrastructure note rather than a comment about this PR specifically (I'm sure you're already aware of it and working on that); how hard would it be to catch docutils.utils.SystemMessage and print out the message in a more useful manner?

Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

PEP number is assigned, here's a few comments on the text.

peps/pep-0789.rst Outdated Show resolved Hide resolved
peps/pep-0789.rst Outdated Show resolved Hide resolved
peps/pep-0789.rst Outdated Show resolved Hide resolved
peps/pep-0789.rst Outdated Show resolved Hide resolved
peps/pep-0789.rst Outdated Show resolved Hide resolved
peps/pep-0789.rst Outdated Show resolved Hide resolved
@AlexWaygood AlexWaygood changed the title PEP 9999: Preventing task-cancellation bugs by limiting yield in async generators PEP 789: Preventing task-cancellation bugs by limiting yield in async generators May 15, 2024
@hugovk
Copy link
Member

hugovk commented May 15, 2024

Please add @njsmith to the CODEOWNERS file.

There's also a "New PEP" checklist at https://github.com/python/peps/blob/main/.github/PULL_REQUEST_TEMPLATE/Add%20a%20new%20PEP.md you could copy into the OP.

peps/pep-0789.rst Show resolved Hide resolved
peps/pep-0789.rst Outdated Show resolved Hide resolved
@Zac-HD Zac-HD requested a review from AA-Turner as a code owner May 15, 2024 15:38
.github/CODEOWNERS Outdated Show resolved Hide resolved
peps/pep-0789.rst Outdated Show resolved Hide resolved
peps/conf.py Outdated Show resolved Hide resolved
@carljm
Copy link
Member

carljm commented May 15, 2024

You've gotten PEP numbers 678 and 789, well planned. Probably you should just reserve 890 now.

peps/pep-0789.rst Outdated Show resolved Hide resolved
peps/pep-0789.rst Outdated Show resolved Hide resolved
peps/pep-0789.rst Outdated Show resolved Hide resolved
For expedience I'm using sphinxcontrib-mermaid here; we can easily embed .png versions before merging if preferred.
peps/pep-0789.rst Outdated Show resolved Hide resolved
peps/pep-0789.rst Outdated Show resolved Hide resolved
@Zac-HD
Copy link
Contributor Author

Zac-HD commented May 31, 2024

@JelleZijlstra I'm happy to call this draft substantively done, and merge it + open a Discuss thread.

Based on discussions at the PyCon language summit and sprints, my impression is that the PEP is likely to be accepted if an implementation with satisfactory performance is available. Next steps are therefore to produce such an implementation! A solid prototype will give us more basis to disucss the remaining todo items, as well as whether and when to use it in the standard library, so I anticipate a quiet period for a few months.

@JelleZijlstra
Copy link
Member

I'm happy with the text, but @njsmith as the sponsor should also confirm that they're OK with merging this.

@njsmith njsmith merged commit 375d7c9 into python:main Jun 4, 2024
6 checks passed
@Zac-HD Zac-HD deleted the preventing-cancel-bugs branch June 4, 2024 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants