Skip to content

Commit 66e1e36

Browse files
authored
Merge pull request numpy#26872 from jorenham/capsule-type
TYP: use `types.CapsuleType` on python>=3.13
2 parents ca522d1 + 363f9a4 commit 66e1e36

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

numpy/__init__.pyi

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,9 +1415,10 @@ _ArrayTD64_co: TypeAlias = NDArray[np.bool | integer[Any] | timedelta64]
14151415
# Introduce an alias for `dtype` to avoid naming conflicts.
14161416
_dtype: TypeAlias = dtype
14171417

1418-
# `builtins.PyCapsule` unfortunately lacks annotations as of the moment;
1419-
# use `Any` as a stopgap measure
1420-
_PyCapsule: TypeAlias = Any
1418+
if sys.version_info >= (3, 13):
1419+
from types import CapsuleType as _PyCapsule
1420+
else:
1421+
_PyCapsule: TypeAlias = Any
14211422

14221423
class _SupportsItem(Protocol[_T_co]):
14231424
def item(self, args: Any, /) -> _T_co: ...

0 commit comments

Comments
 (0)