-
Notifications
You must be signed in to change notification settings - Fork 289
Closed
Labels
Description
class Foo(NamedTuple):
x: bool = Falseproduces an error message similar to,
File "/Users/pa-loaner/Snapchat/Dev/.venvs/typeshed/lib/python3.9/site-packages/pytype/ast/visitor.py", line 55, in _call_visitor
return visitor(node)
File "/Users/pa-loaner/Snapchat/Dev/.venvs/typeshed/lib/python3.9/site-packages/pytype/pyi/parser.py", line 477, in visit_AnnAssign
raise ParseError(msg)
pytype.pyi.types.ParseError: File: "stubs/tensorflow/tensorflow/io/__init__.pyi", line 56
default_value: _TensorCompatible | None = None
^
ParseError: Default value for default_value: typing.Union can only be '...', got None
I think it then leads to various noise errors elsewhere due to parse error. Originally hit here by running pytype_test.py stubs/tensorflow/io but you can run pytype_test.py stubs/tensorflow/toy and add a file in toy with just example at top to trigger this error. The error looks to be specific to stub files and normal .py files are fine.
edit: Looking a bit more at code/stacktrace I'm unsure this is unique to namedtuples although probably most common to see default with them in class body.