Title: Shouldn't `AsyncExitStack.__aexit__` return `_ExitT_co`? · Issue #14384 · python/typeshed · GitHub
Open Graph Title: Shouldn't `AsyncExitStack.__aexit__` return `_ExitT_co`? · Issue #14384 · python/typeshed
X Title: Shouldn't `AsyncExitStack.__aexit__` return `_ExitT_co`? · Issue #14384 · python/typeshed
Description: Right now, AsyncExitStack.__aexit__ unconditionally returns a bool. However, this in contrast to ExitStack.__exit__, which returns the generic _ExitT_co with a bound of bool | None. Why is that? It looks like the actual implementations i...
Open Graph Description: Right now, AsyncExitStack.__aexit__ unconditionally returns a bool. However, this in contrast to ExitStack.__exit__, which returns the generic _ExitT_co with a bound of bool | None. Why is that? It...
X Description: Right now, AsyncExitStack.__aexit__ unconditionally returns a bool. However, this in contrast to ExitStack.__exit__, which returns the generic _ExitT_co with a bound of bool | None. Why is that? It...
Opengraph URL: https://github.com/python/typeshed/issues/14384
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Shouldn't `AsyncExitStack.__aexit__` return `_ExitT_co`?","articleBody":"Right now, `AsyncExitStack.__aexit__` unconditionally returns a `bool`. However, this in contrast to `ExitStack.__exit__`, which returns the generic `_ExitT_co` with a bound of `bool | None`. Why is that? It looks like the actual implementations in `contextlib` are nearly identical, so I can't readily explain that decision.\n\nStrictly speaking, I think `bool` is more correct for both, since the actual return value of both `ExitStack` and `AsyncExitStack` is a `bool`. But I suspect the type hints were structured this way to allow type checkers to determine whether the context manager swallows exceptions or not. That's explicitly the behavior of pyright (see [here](https://github.com/microsoft/pyright/issues/3701)). If that's the case, why is there a difference between `ExitStack` and `AsyncExitStack` here? Is it intentional? Or just an oversight?","author":{"url":"https://github.com/bradleyharden","@type":"Person","name":"bradleyharden"},"datePublished":"2025-07-08T20:39:08Z","url":"https://github.com/python/typeshed/issues/14384"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9359beca-2934-a91b-7d05-f223137ac292 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DF04:2F2EB9:3248EA3:42CFFBD:6B003A24 |
| html-safe-nonce | 3f9679ac1e48d8cbb33f159206b39e5b6ae6128265071f71028ca6bfa3fa1944 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjA0OjJGMkVCOTozMjQ4RUEzOjQyQ0ZGQkQ6NkIwMDNBMjQiLCJ2aXNpdG9yX2lkIjoiMjU2ODQ5MDI1MTI1MzIwMTQ0NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8ea3843ab671bd324528e96238a0a930b26e777a1c76d23b54a071c28d50a2bd |
| hovercard-subject-tag | issue:3213722184 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/typeshed/14384/issue_layout |
| twitter:image | https://opengraph.githubassets.com/edbee178d1aa06dfa983f92bd74fa15f0cd6a8620f728747888787deba3a1dc8/python/typeshed/issues/14384 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/edbee178d1aa06dfa983f92bd74fa15f0cd6a8620f728747888787deba3a1dc8/python/typeshed/issues/14384 |
| og:image:alt | Right now, AsyncExitStack.__aexit__ unconditionally returns a bool. However, this in contrast to ExitStack.__exit__, which returns the generic _ExitT_co with a bound of bool | None. Why is that? It... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bradleyharden |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width