Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
Closed
Description
Crash Report
Creating aTypedDict with non-literal keys givesTypedDict() expects a dictionary literal as the second argument. Attempting to ignore this with# type: ignore causes anAssertionError if (and only if):
- any error (unrelated to TypedDict) happens later in a different module that imports the one with the
TypedDictdefinition - and
.mypy_cacheexists
Traceback
✗ mypy --show-traceback main.pymain.py:3: error: Unsupported operand types for + ("int" and "str") [operator]Found 1 error in 1 file (checked 1 source file)✗ mypy --show-traceback main.pyTraceback (most recent call last): (...) File "mypy/main.py", line 95, in main File "mypy/main.py", line 174, in run_build File "mypy/build.py", line 197, in build File "mypy/build.py", line 270, in _build File "mypy/build.py", line 2927, in dispatch File "mypy/build.py", line 3318, in process_graph File "mypy/build.py", line 3399, in process_fresh_modules File "mypy/build.py", line 2114, in fix_cross_refs File "mypy/fixup.py", line 53, in fixup_module File "mypy/fixup.py", line 126, in visit_symbol_tableAssertionError: ('counts.Counts', 'counts.TypedDict')To Reproduce
# counts.pyfromtypingimportTypedDictCounts=TypedDict("Counts", {k:intforkin"abc"})# type: ignore
# main.pyfromcountsimportCountsprint(1+"a")
Your Environment
- Mypy version used: 1.4.1
- Python version used: 3.10