Closed
Description
Although warnings.catch_warnings with record=True
returns
a list, mypy is not aware of that:
File foo.py
:
import warnings
with warnings.catch_warnings(record=True) as w:
print(len(w))
Command mypy foo.py
gives:
$ mypy foo.py
foo.py:4: error: Argument 1 to "len" has incompatible type "Optional[List[_Record]]"; expected "Sized"
Found 1 error in 1 file (checked 1 source file)
Using recent mypy from master (0.750+dev.e97377c454a1d5c019e9c56871d5f229db6b47b2
).
I've attached PR fixing this #3464.
Metadata
Metadata
Assignees
Labels
No labels