8000 gh-115165: Fix Annotated for immutable types by dave-shawley · Pull Request #115213 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-115165: Fix Annotated for immutable types #115213

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 6 commits into from
Feb 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! gh-115165: Fix Annotated for immutable types
Add a test for generic instantiation that trips the same __setattr__
exception in Annotation.
  • Loading branch information
dave-shawley committed Feb 9, 2024
commit 7fcb3945ddb595eecad5c3fdd2be7af9a348d4a3
7 changes: 7 additions & 0 deletions Lib/test/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4323,6 +4323,13 @@ class C(B[int]):
c.bar = 'abc'
self.assertEqual(c.__dict__, {'bar': 'abc'})

def test_getattr_exceptions(self):
class Immutable[T]:
def __setattr__(self, key, value):
raise RuntimeError("immutable")

Immutable[int]()

def test_subscripted_generics_as_proxies(self):
T = TypeVar('T')
class C(Generic[T]):
Expand Down
0