-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
addressed in next versionIssue is fixed and will appear in next published versionIssue is fixed and will appear in next published versionbugSomething isn't workingSomething isn't workingregression
Description
Describe the bug
Cf. python/typeshed#12764. When trying to update pyright from 1.1.383 to 1.1.384 in typeshed, it reports NamedTuples that use ellipses as defaults:
class ToCPlaceholder(NamedTuple):
render_function: Callable[[FPDF, Any], object]
start_page: int
y: int
pages: int = ...Causes:
/home/runner/work/typeshed/typeshed/stubs/fpdf2/fpdf/fpdf.pyi
/home/runner/work/typeshed/typeshed/stubs/fpdf2/fpdf/fpdf.pyi:97:18 - error: Type "EllipsisType" is not assignable to declared type "int"
"EllipsisType" is not assignable to "int" (reportAssignmentType)
Similar to function defaults, NamedTuples can have complex defaults that can't be represented statically in stubs and should use an ellipsis instead.
In [1]: from typing import NamedTuple
In [2]: x = 42
In [3]: class Foo(NamedTuple):
...: a: int
...: b: int = x
...:
In [4]: Foo(12)
Out[4]: Foo(a=12, b=42)Avasam
Metadata
Metadata
Assignees
Labels
addressed in next versionIssue is fixed and will appear in next published versionIssue is fixed and will appear in next published versionbugSomething isn't workingSomething isn't workingregression