Skip to content

"Invalid self argument" for numpy's iadd #19171

Open
numpy/numpy
#29092
@bersbersbers

Description

@bersbersbers

To Reproduce

from typing import Any

import numpy as np
import numpy.typing as npt

def plus1(array: npt.NDArray[np.integer[Any]]) -> None:
    array += 1

Expected Behavior

No error

Actual Behavior

error: Invalid self argument "ndarray[tuple[int, ...], dtype[integer[Any]]]" to attribute function "iadd" with type "Callable[[ndarray[tuple[int, ...], dtype[numpy.bool[builtins.bool]]], _SupportsArray[dtype[numpy.bool[builtins.bool]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool]]]] | builtins.bool | _NestedSequence[builtins.bool]], ndarray[_ShapeT_co, _DType_co]]" [misc]

Your Environment

  • Mypy version used: 1.16.0
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): none
  • Python version used: 3.13.2
  • Numpy version used: 2.2.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions