Skip to content

Mypy is reporting incorrect line numbers on a 2.7kloc files. #21902

Description

@fjovell-swish

Bug Report

Trying to typecheck the OCPP package, and when running mypy against v201/enums.py file, I get the following error:

$ mypy ocpp/v201/enums.py

Expected Behavior

Line numbers to be correctly displayed and errors to make sense in the context.

Actual Behavior

ocpp/v201/enums.py:1485: error: Incompatible types in assignment (expression has type "StandardizedVariableName", base class "str" defined the type as "Callable[[str, SupportsIndex | None, SupportsIndex | None], int]")  [assignment]
ocpp/v201/enums.py:2649: error: Incompatible types in assignment (expression has type "SpacesCountSignageVariableName", base class "str" defined the type as "Callable[[str, SupportsIndex | None, SupportsIndex | None], int]")  [assignment]
Found 2 errors in 1 file (checked 1 source file)

Your Environment

  • Mypy version used: mypy 2.3.1 (compiled: yes)
  • Mypy command-line flags: --strict
  • Mypy configuration options from mypy.ini (and other config files): none
  • Python version used: python3.11
  • OS: MacOS Tahoe 26.6.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions