Skip to content

Code is unexpectedly marked as unreachable #3195

@xingjianleng

Description

@xingjianleng

Environment data

  • Language Server version: Pylance language server 2022.8.20 (pyright 888eb243)
  • OS and version: macOS 12.5 (arm64)
  • Python version (& distribution if applicable, e.g. Anaconda): Miniconda CPython 3.9.12

Code Snippet

import numpy as np


x = np.array([1,2,3])
y = np.array([2,3,4])

z = np.cross(x, y)
print(z)

Repro Steps

  1. Install numpy dependencies and run the above code.

Expected behavior

Code should not be marked as unreachable

Actual behavior

The last line of code print(z) is marked as unreachable.

It is also observed in other Python scripts where sections of code followed by np.cross() are marked as unreachable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions