Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Fix an incorrect protocol used in np.lib.shape_base #20436

Merged
merged 1 commit into from Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions numpy/lib/shape_base.pyi
Expand Up @@ -18,7 +18,7 @@ from numpy.typing import (
NDArray,
_ShapeLike,
_FiniteNestedSequence,
_SupportsDType,
_SupportsArray,
_ArrayLikeBool_co,
_ArrayLikeUInt_co,
_ArrayLikeInt_co,
Expand All @@ -31,7 +31,7 @@ from numpy.core.shape_base import vstack

_SCT = TypeVar("_SCT", bound=generic)

_ArrayLike = _FiniteNestedSequence[_SupportsDType[dtype[_SCT]]]
_ArrayLike = _FiniteNestedSequence[_SupportsArray[dtype[_SCT]]]

# The signatures of `__array_wrap__` and `__array_prepare__` are the same;
# give them unique names for the sake of clarity
Expand Down
8 changes: 8 additions & 0 deletions numpy/typing/tests/data/fail/shape_base.pyi
@@ -0,0 +1,8 @@
import numpy as np

class DTypeLike:
dtype: np.dtype[np.int_]

dtype_like: DTypeLike

np.expand_dims(dtype_like, (5, 10)) # E: No overload variant