Skip to content

Make TaskGroup.__aexit__ return Literal[False]#472

Open
eitan-protego wants to merge 7 commits into
fastapi:mainfrom
eitan-protego:main
Open

Make TaskGroup.__aexit__ return Literal[False]#472
eitan-protego wants to merge 7 commits into
fastapi:mainfrom
eitan-protego:main

Conversation

@eitan-protego

Copy link
Copy Markdown

Defining TaskGroup.__aexit__ explicitly always return False allows type checkers to safely assume that all code inside of it ran to completion without swallowing exceptions. This in turn prevents type errors about variables defined inside the async with block being possibly undefined.

eitan-protego and others added 3 commits February 17, 2026 12:59
Defining TaskGroup.__aexit__ explicitly always return False allows type checkers to safely assume that all code inside of it ran to completion without swallowing exceptions. This in turn prevents type errors about variables defined inside the `async with` block being possibly undefined.
@svlandeg svlandeg added the feature New feature or request label Feb 17, 2026
@github-actions github-actions Bot added the conflicts Automatically generated when a PR has a merge conflict label Feb 20, 2026
@github-actions

This comment was marked as resolved.

@github-actions github-actions Bot removed the conflicts Automatically generated when a PR has a merge conflict label Feb 22, 2026
@eitan-protego

Copy link
Copy Markdown
Author

@tiangolo I'd appreciate if you'd review this and let me know if you're inclined to accept it (or if I'm missing something and in fact __aexit__ is capable of returning True, making this change unsafe).

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

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants