Skip to content

BUG: typings: a - b returns NoReturn instead of ndarray #20265

@nschloe

Description

@nschloe

Describe the issue:

Running

pyright foo.py

on

import numpy as np


def myfun(x: np.ndarray, b: np.ndarray):
    v = b - x
    v.copy()

gives

  /tmp/dummy.py:6:7 - error: Cannot access member "copy" for type "NoReturn"
    Member "copy" is unknown (reportGeneralTypeIssues)

The vector operations +, *, / work fine.

NumPy/Python version information:

1.21.3 3.9.7 (default, Sep 10 2021, 14:59:43)
[GCC 11.2.0]

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