Skip to content

Commit

Permalink
Merge pull request #20436 from charris/backport-20433
Browse files Browse the repository at this point in the history
BUG: Fix an incorrect protocol used in ``np.lib.shape_base``
  • Loading branch information
charris committed Nov 22, 2021
2 parents 265118d + 5a5f800 commit 6037fbd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
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

0 comments on commit 6037fbd

Please sign in to comment.