Skip to content

NamedTuple no longer includes ellipsis for fields with default values #15638

Closed
@ericstarr

Description

@ericstarr

Bug Report

In the past, stubgen would indicate NamedTuple fields with default values using an ellipsis. Now it does not indicate which fields have default values in any way. I don't know exactly what version I used to generate my old stubs, but it was about 2 years ago.

To Reproduce

Run stubgen on a python file containing the following

from typing import NamedTuple

class Spam(NamedTuple):
    a: int
    b: int = 1

Expected Behavior

The generated stub should look like

from typing import NamedTuple

class Spam(NamedTuple):
    a: int
    b: int = ...

Actual Behavior

The generated stub looks like

from typing import NamedTuple

class Spam(NamedTuple):
    a: int
    b: int

Your Environment

  • Mypy version used: 1.4.1
  • Mypy command-line flags: None
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: 3.9

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions