Skip to content

AssertionError in deeply nested class scenario (incremental with warm cache) #2931

Closed
@ilevkivskyi

Description

@ilevkivskyi

This is a small remainder of #2535

Example to reproduce: run mypy -i main.py twice (without touching any files in between) where:

  • main.py
import ntcrash
  • ntcrash.py
from typing import NamedTuple

class C:
    def f(self) -> None:
        class D:
            class E:
                def g(self) -> None:
                    A = NamedTuple('A', [('x', int), ('y', int)])
                    self.a = A(1, 1)
        self.c = D.E().a

Possible fix would be to store all "anonymous" classes in globals.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions