Skip to content

"maximum semantic analysis iteration count" when combining nested dataclass and undefined field. #11645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jonathanslenders opened this issue Nov 30, 2021 · 1 comment

Comments

@jonathanslenders
Copy link

jonathanslenders commented Nov 30, 2021

Bug Report

The following little snippet causes the following error:

test.py: error: INTERNAL ERROR: maximum semantic analysis iteration count reached

To Reproduce

Create the following file. I know several things are not correct in this file, but that's absolutely the purpose.

from dataclasses import dataclass

def func() -> None:
    @dataclass
    class RequestWriter:
        field: bool

        def func() -> None:
            something_not_defined

Run mypy over it. This is the output:

 $ mypy client1.py
Deferral trace:
    client1:11
    client1:11
    client1:11
    client1:11
    client1:11
    client1:11
    client1:11
    client1:11
    client1:11
    client1:11
    client1:11
    client1:11
    client1:11
    client1:11
    client1:11
    client1:11
    client1:11
    client1:11
    client1:11
client1.py: error: INTERNAL ERROR: maximum semantic analysis iteration count reached
client1.py:10: error: Method must have at least one argument
Found 2 errors in 1 file (errors prevented further checking)

Expected Behavior

Mypy should probably point out that:

  • something_not_defined is not defined.

Your Environment

  • Mypy version used: 0.910
  • Mypy command-line flags: None
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: 3.9.5
  • Operating system and version: Ubuntu 20.04.1
@jonathanslenders jonathanslenders added the bug mypy got something wrong label Nov 30, 2021
@jonathanslenders jonathanslenders changed the title "maximum semantic analysis iteration count" when combining dataclass, protocol and undefined field. "maximum semantic analysis iteration count" when combining nested dataclass and undefined field. Nov 30, 2021
@AlexWaygood AlexWaygood added crash topic-dataclasses and removed bug mypy got something wrong labels Mar 26, 2022
@AlexWaygood
Copy link
Member

Thanks for the report! I'm going to close this as a duplicate of #8703

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants