Skip to content

Dynamic base classes are not handled #2477

@snakescott

Description

@snakescott

repro:

  • set some $BASEDIR for files
  • git clone https://github.com/python/typeshed.git $BASEDIR/typeshed
  • cd $BASEDIR/typeshed; git checkout f36d7a3; rm -rf third_party/2/sqlalchemy/ (note: sqlalchemy stubs are incomplete, so ignore them)
  • put the following code at $BASEDIR/failure.py
from sqlalchemy import Column, String
Base = declarative_base()

class Foo(Base):
  __tablename__ = 'foo'
  key = Column(String, primary_key=True)
  • install mypy 0.4.6
  • run mypy --py2 -v -v -v --fast-parser -s --custom-typeshed-dir $BASEDIR/typeshed $BASEDIR/failure.py

Output is something like

failure.py:33: error: Invalid type "failure.Base"
failure.py:33: error: Invalid base class

when it should be clean

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions