Skip to content
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

INTERNAL ERROR triggered by broken typing #219

Open
aberres opened this issue Jul 11, 2022 · 1 comment
Open

INTERNAL ERROR triggered by broken typing #219

aberres opened this issue Jul 11, 2022 · 1 comment
Labels
bug Something isn't working mypy plugin something that has to do with the sqlalchemy mypy plugin

Comments

@aberres
Copy link

aberres commented Jul 11, 2022

Describe the bug
Exception with INTERNAL ERROR: maximum semantic analysis iteration count reached

Expected behavior

A message like error: Name "Address" is not defined [name-defined]

To Reproduce
Type check the code below.

Obviously, there is not class Address. When removing the base class, the error is emitted as expected. Stumbled upon this problem when having a typo in a relation.

from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base


def test_soft():
    Base = declarative_base()

    class User(Base):
        __tablename__ = "user"

        id = Column(Integer, primary_key=True)
        addresses: list[Address]

Error

Deferral trace:
    [...]
    m2p.utils.tests.test_softdelete:12
    m2p.utils.tests.test_softdelete:12
    m2p.utils.tests.test_softdelete:12
    m2p.utils.tests.test_softdelete:12
    m2p.utils.tests.test_softdelete:12
    m2p.utils.tests.test_softdelete:12
    m2p.utils.tests.test_softdelete:12
test_softdelete.py: error: INTERNAL ERROR: maximum semantic analysis iteration count reached

Versions.

  • Python: 3.10
  • SQLAlchemy: 1.4.39
  • mypy: 0.961
  • SQLAlchemy2-stubs: 0.0.2a24
@aberres aberres added the requires triage New issue that requires categorization label Jul 11, 2022
@CaselIT CaselIT added bug Something isn't working mypy plugin something that has to do with the sqlalchemy mypy plugin and removed requires triage New issue that requires categorization labels Jul 11, 2022
@CaselIT
Copy link
Member

CaselIT commented Jul 11, 2022

This is related to the mypy plugin. Since v2 will not use it it's unlikely that it will be fixed. PR are welcome though.
(The plugin code lives in the main sqlalchemy repo)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mypy plugin something that has to do with the sqlalchemy mypy plugin
Projects
None yet
Development

No branches or pull requests

2 participants