Skip to content

mypy doesn't understand six.with_metaclass #1764

Closed
@Diggsey

Description

@Diggsey

Example:

import six


class TestBase(object):
    pass


class TestMeta(type):
    pass


class Test(six.with_metaclass(TestMeta, TestBase)):
    pass

In this case, mypy returns error: Invalid base class. However, in my larger project it actually caused mypy to crash while checking a type derived from the Test analogue. Unfortunately I wasn't able to reproduce this in a small example, but switching to @six.add_metaclass fixed the problem.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions