-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix second generic for
AbstractContextManager
being ignored when de…
…termining whether the context manager can suppress exceptions
- Loading branch information
1 parent
9b874de
commit 10d8466
Showing
3 changed files
with
40 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/pyright-internal/src/tests/samples/withGenericExitType.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import contextlib | ||
from typing import Literal | ||
|
||
def _(cm: contextlib.AbstractContextManager[object, Literal[True]]): | ||
with cm: | ||
raise Exception | ||
print(1) # reachable | ||
|
||
def _(cm: contextlib.AbstractContextManager[object, Literal[False]]): | ||
with cm: | ||
raise Exception | ||
print(1) # error: unreachable |