You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to request that the TC consider adoption of a new (small) chapter in the typing spec that spells out the type checking behaviors for context managers — specifically, how to use the return type of __exit__ to determine whether a context manager suppresses exceptions.
Links to PR & Discussion
The PR can be found here. It incorporates feedback from PR reviewers.
Current Type Checker Behaviors
The specified behavior is consistent with the current behavior of mypy and pyright. It is also consistent with assumptions that are baked into typeshed stubs. I haven't done detailed testing on pyre or pytype, but given that they leverage typeshed stubs, they likely conform.
The text was updated successfully, but these errors were encountered:
(While I didn't approve the PR yet, my feedback there is just two nits, and even if you didn't address those I'm happy with this chapter, as it describes existing practice.)
I'd like to request that the TC consider adoption of a new (small) chapter in the typing spec that spells out the type checking behaviors for context managers — specifically, how to use the return type of
__exit__
to determine whether a context manager suppresses exceptions.Links to PR & Discussion
The PR can be found here. It incorporates feedback from PR reviewers.
The discussion can be found here.
TC Sign-off
Current Type Checker Behaviors
The specified behavior is consistent with the current behavior of mypy and pyright. It is also consistent with assumptions that are baked into typeshed stubs. I haven't done detailed testing on pyre or pytype, but given that they leverage typeshed stubs, they likely conform.
The text was updated successfully, but these errors were encountered: