Skip to content

[3.11] gh-111085: Fix invalid state handling in TaskGroup and Timeout (GH-111111) #111172

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

Merged
merged 1 commit into from
Oct 21, 2023

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Oct 21, 2023

asyncio.TaskGroup and asyncio.Timeout classes now raise proper RuntimeError
if they are improperly used.

  • When they are used without entering the context manager.
  • When they are used after finishing.
  • When the context manager is entered more than once (simultaneously or
    sequentially).
  • If there is no current task when entering the context manager.

They now remain in a consistent state after an exception is thrown,
so subsequent operations can be performed correctly (if they are allowed).

(cherry picked from commit 6c23635)

Co-authored-by: Serhiy Storchaka [email protected]
Co-authored-by: James Hilton-Balfe [email protected]

…ythonGH-111111)

asyncio.TaskGroup and asyncio.Timeout classes now raise proper RuntimeError
if they are improperly used.

* When they are used without entering the context manager.
* When they are used after finishing.
* When the context manager is entered more than once (simultaneously or
  sequentially).
* If there is no current task when entering the context manager.

They now remain in a consistent state after an exception is thrown,
so subsequent operations can be performed correctly (if they are allowed).

(cherry picked from commit 6c23635)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: James Hilton-Balfe <[email protected]>
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.

3 participants