Skip to content

Commit b68854d

Browse files
committed
Add typing for long. Add release note
1 parent 77919ed commit b68854d

File tree

6 files changed

+19
-2
lines changed

6 files changed

+19
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
`numpy.long` and `numpy.ulong`
2+
------------------------------
3+
4+
`numpy.long` and `numpy.ulong` have been reintroduced as a direct
5+
mapping to C's ``long`` and ``unsigned long`` types.

numpy/__init__.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ from numpy._typing import (
7171
_NBitIntC,
7272
_NBitIntP,
7373
_NBitInt,
74+
_NBitLong,
7475
_NBitLongLong,
7576
_NBitHalf,
7677
_NBitSingle,
@@ -97,12 +98,14 @@ from numpy._typing import (
9798
_IntCCodes,
9899
_IntPCodes,
99100
_IntCodes,
101+
_LongCodes,
100102
_LongLongCodes,
101103
_UByteCodes,
102104
_UShortCodes,
103105
_UIntCCodes,
104106
_UIntPCodes,
105107
_UIntCodes,
108+
_ULongCodes,
106109
_ULongLongCodes,
107110
_HalfCodes,
108111
_SingleCodes,
@@ -2858,6 +2861,7 @@ short = signedinteger[_NBitShort]
28582861
intc = signedinteger[_NBitIntC]
28592862
intp = signedinteger[_NBitIntP]
28602863
int_ = signedinteger[_NBitInt]
2864+
long = signedinteger[_NBitLong]
28612865
longlong = signedinteger[_NBitLongLong]
28622866

28632867
# TODO: `item`/`tolist` returns either `dt.timedelta` or `int`
@@ -2939,6 +2943,7 @@ ushort = unsignedinteger[_NBitShort]
29392943
uintc = unsignedinteger[_NBitIntC]
29402944
uintp = unsignedinteger[_NBitIntP]
29412945
uint = unsignedinteger[_NBitInt]
2946+
ulong = unsignedinteger[_NBitLong]
29422947
ulonglong = unsignedinteger[_NBitLongLong]
29432948

29442949
class inexact(number[_NBit1]): # type: ignore

numpy/_typing/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ class _8Bit(_16Bit): # type: ignore[misc]
9898
_NBitIntC as _NBitIntC,
9999
_NBitIntP as _NBitIntP,
100100
_NBitInt as _NBitInt,
101+
_NBitLong as _NBitLong,
101102
_NBitLongLong as _NBitLongLong,
102103
_NBitHalf as _NBitHalf,
103104
_NBitSingle as _NBitSingle,
@@ -124,12 +125,14 @@ class _8Bit(_16Bit): # type: ignore[misc]
124125
_IntCCodes as _IntCCodes,
125126
_IntPCodes as _IntPCodes,
126127
_IntCodes as _IntCodes,
128+
_LongCodes as _LongCodes,
127129
_LongLongCodes as _LongLongCodes,
128130
_UByteCodes as _UByteCodes,
129131
_UShortCodes as _UShortCodes,
130132
_UIntCCodes as _UIntCCodes,
131133
_UIntPCodes as _UIntPCodes,
132134
_UIntCodes as _UIntCodes,
135+
_ULongCodes as _ULongCodes,
133136
_ULongLongCodes as _ULongLongCodes,
134137
_HalfCodes as _HalfCodes,
135138
_SingleCodes as _SingleCodes,

numpy/_typing/_char_codes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,16 @@
2323
_ShortCodes = Literal["short", "h", "=h", "<h", ">h"]
2424
_IntCCodes = Literal["intc", "i", "=i", "<i", ">i"]
2525
_IntPCodes = Literal["intp", "p", "=p", "<p", ">p"]
26-
_IntCodes = Literal["long", "int", "int_", "l", "=l", "<l", ">l"]
26+
_IntCodes = Literal["int", "int_", "l", "=l", "<l", ">l"]
27+
_LongCodes = Literal["long"]
2728
_LongLongCodes = Literal["longlong", "q", "=q", "<q", ">q"]
2829

2930
_UByteCodes = Literal["ubyte", "B", "=B", "<B", ">B"]
3031
_UShortCodes = Literal["ushort", "H", "=H", "<H", ">H"]
3132
_UIntCCodes = Literal["uintc", "I", "=I", "<I", ">I"]
3233
_UIntPCodes = Literal["uintp", "P", "=P", "<P", ">P"]
33-
_UIntCodes = Literal["ulong", "uint", "L", "=L", "<L", ">L"]
34+
_UIntCodes = Literal["uint", "L", "=L", "<L", ">L"]
35+
_ULongCodes = Literal["ulong"]
3436
_ULongLongCodes = Literal["ulonglong", "Q", "=Q", "<Q", ">Q"]
3537

3638
_HalfCodes = Literal["half", "e", "=e", "<e", ">e"]

numpy/_typing/_nbit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
_NBitIntC = Any
99
_NBitIntP = Any
1010
_NBitInt = Any
11+
_NBitLong = Any
1112
_NBitLongLong = Any
1213

1314
_NBitHalf = Any

numpy/typing/mypy_plugin.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def _get_precision_dict() -> dict[str, str]:
6060
("_NBitIntC", np.intc),
6161
("_NBitIntP", np.intp),
6262
("_NBitInt", np.int_),
63+
("_NBitLong", np.long),
6364
("_NBitLongLong", np.longlong),
6465

6566
("_NBitHalf", np.half),

0 commit comments

Comments
 (0)