Skip to content

Regression on master branch: false-positive error for enum mixin data types #12258

Closed
@AlexWaygood

Description

@AlexWaygood

Using the current master branch, mypy reports a false positive error for the following snippet of code:

from enum import Enum

class MyEnum(Enum): ...

class BytesEnum(bytes, MyEnum): ...  # error: Only a single data type mixin is allowed for Enum subtypes, found extra "enum_test.MyEnum"

The error is not reported using mypy 0.931.

Expected behaviour

There should be no error reported; this works fine at runtime (and this inheritance structure is in fact used within enum.py in the CPython stdlib).

Related:

cc. @sobolevn

Metadata

Metadata

Assignees

Labels

bugmypy got something wrong

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions