Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Incompatible definition of methods reported when using multiple inheritance #9319

Closed
Labels
bugmypy got something wrongfalse-positivemypy gave an error on correct code
@frerich

Description

@frerich

Using mypy 0.782, errors about incompatible method redefinitions are issued -- but only if multiple inheritance is in play.

How to Reproduce

Run mypy (without any arguments) on this script:

importenumclassC:passclassD(C,enum.IntFlag):pass

Expected behaviour

mypy should print

Success: no issues found in 1 source file

Actual behaviour

mypy prints three error messages:

mypy-error.py:6: error: Definition of "__xor__" in base class "int" is incompatible with definition in base class "Flag"mypy-error.py:6: error: Definition of "__or__" in base class "int" is incompatible with definition in base class "Flag"mypy-error.py:6: error: Definition of "__and__" in base class "int" is incompatible with definition in base class "Flag"Found 3 errors in 1 file (checked 1 source file)

Comments

The error messages go away when

  • Not using multiple inheritance, i.e.class D(enum.IntFlag) instead ofclass D(C, enum.IntFlag).
  • Or: when usingenum.Flag instead ofenum.IntFlag

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongfalse-positivemypy gave an error on correct code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp