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
mypy doesn't synthesize the __readonly_keys__ and __mutable_keys__ class attributes of TypedDict, introduced in Python 3.13. This leads to stubtest complaining about each instance of a TypedDict due to the attributes missing from the stubs.
To Reproduce
# foo.pyfromtypingimportTypedDictclassFoo(TypedDict):
bar: strprint(Foo.__readonly_keys__) # at runtime: frozenset()print(Foo.__mutable_keys__) # at runtime: frozenset({'bar'})
Expected Behavior
Using mypy --python-version 3.13 foo.py: no errors.
Actual Behavior
foo.py:8: error: "type[Foo]" has no attribute "__readonly_keys__" [attr-defined]
foo.py:9: error: "type[Foo]" has no attribute "__mutable_keys__" [attr-defined]
Found 2 errors in 1 file (checked 1 source file)
Your Environment
Mypy version used: 1.15.0
Mypy command-line flags: --python-version 3.13
Mypy configuration options from mypy.ini (and other config files): ./.
Python version used: 3.12
The text was updated successfully, but these errors were encountered:
Bug Report
Cf. python/typeshed#13638
mypy doesn't synthesize the
__readonly_keys__
and__mutable_keys__
class attributes ofTypedDict
, introduced in Python 3.13. This leads to stubtest complaining about each instance of aTypedDict
due to the attributes missing from the stubs.To Reproduce
Expected Behavior
Using
mypy --python-version 3.13 foo.py
: no errors.Actual Behavior
Your Environment
mypy.ini
(and other config files): ./.The text was updated successfully, but these errors were encountered: