Skip to content

TYP: np.mod(npt.NDArray, Any) is Any in 2.2.2 while it wasn't in 2.2.1 #28192

@bersbersbers

Description

@bersbersbers

Describe the issue:

numpy 2.2.2 reveals a different type for np.mod(npt.NDArray, Any) than 2.2.1. This looks like a result of #28176. Please close if this is an intended change.

Reproduce the code example:

from typing import Any

import numpy as np
import numpy.typing as npt


def func(x: npt.NDArray[np.integer[Any]], y: Any) -> None:
    reveal_type(np.mod(x, y))

Error message:

2.2.1: "numpy.ndarray[builtins.tuple[builtins.int, ...], numpy.dtype[Any]]"
2.2.2: "Any"

Python and NumPy Versions:

Numpy 2.2.2 vs 2.2.1

Type-checker version and settings:

mypy 1.14.1 (compiled: yes)

Additional typing packages.

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions