summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@gmail.com>2022-11-28 20:05:21 +0100
committerGitHub <noreply@github.com>2022-11-28 20:05:21 +0100
commit7f0f045625022c3f816911cd80f8635ac2a36f21 (patch)
treeda62a860e65b7f6087fc0db763a3e770b49cda20
parent005ca000a967b8c575dd8d8773f2f3d92f184f4d (diff)
parent5f0f1e6c476fd4edfd58fd459666301e38a46a58 (diff)
downloadnumpy-7f0f045625022c3f816911cd80f8635ac2a36f21.tar.gz
Merge pull request #22637 from seberg/cython_long_t
API: (cython) remove `long_t` and `ulong_t`
-rw-r--r--doc/release/upcoming_changes/22637.compatibility.rst15
-rw-r--r--numpy/__init__.cython-30.pxd2
-rw-r--r--numpy/__init__.pxd2
3 files changed, 15 insertions, 4 deletions
diff --git a/doc/release/upcoming_changes/22637.compatibility.rst b/doc/release/upcoming_changes/22637.compatibility.rst
new file mode 100644
index 000000000..a35b70861
--- /dev/null
+++ b/doc/release/upcoming_changes/22637.compatibility.rst
@@ -0,0 +1,15 @@
+Cython ``long_t`` and ``ulong_t`` removed
+-----------------------------------------
+``long_t`` and ``ulong_t`` were aliases for ``longlong_t`` and ``ulonglong_t``
+and confusing (a remainder from of Python 2). This change may lead to the errors::
+
+ 'long_t' is not a type identifier
+ 'ulong_t' is not a type identifier
+
+We recommend use of bit-sized types such as ``cnp.int64_t`` or the use of
+``cnp.intp_t`` which is 32 bits on 32 bit systems and 64 bits on 64 bit
+systems (this is most compatible with indexing).
+If C ``long`` is desired, use plain ``long`` or ``npy_long``.
+``cnp.int_t`` is also ``long`` (NumPy's default integer). However, ``long``
+is 32 bit on 64 bit windows and we may wish to adjust this even in NumPy.
+(Please do not hesitate to contact NumPy developers if you are curious about this.)
diff --git a/numpy/__init__.cython-30.pxd b/numpy/__init__.cython-30.pxd
index 5fd6086e0..7771d32bd 100644
--- a/numpy/__init__.cython-30.pxd
+++ b/numpy/__init__.cython-30.pxd
@@ -753,11 +753,9 @@ ctypedef double complex complex128_t
# The int types are mapped a bit surprising --
# numpy.int corresponds to 'l' and numpy.long to 'q'
ctypedef npy_long int_t
-ctypedef npy_longlong long_t
ctypedef npy_longlong longlong_t
ctypedef npy_ulong uint_t
-ctypedef npy_ulonglong ulong_t
ctypedef npy_ulonglong ulonglong_t
ctypedef npy_intp intp_t
diff --git a/numpy/__init__.pxd b/numpy/__init__.pxd
index 03db9a0c1..5ecdf3d0f 100644
--- a/numpy/__init__.pxd
+++ b/numpy/__init__.pxd
@@ -711,11 +711,9 @@ ctypedef double complex complex128_t
# The int types are mapped a bit surprising --
# numpy.int corresponds to 'l' and numpy.long to 'q'
ctypedef npy_long int_t
-ctypedef npy_longlong long_t
ctypedef npy_longlong longlong_t
ctypedef npy_ulong uint_t
-ctypedef npy_ulonglong ulong_t
ctypedef npy_ulonglong ulonglong_t
ctypedef npy_intp intp_t