Skip to content

Commit

Permalink
Merge pull request numpy#22637 from seberg/cython_long_t
Browse files Browse the repository at this point in the history
API: (cython) remove `long_t` and `ulong_t`
  • Loading branch information
rgommers authored Nov 28, 2022
2 parents 005ca00 + 5f0f1e6 commit 7f0f045
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
15 changes: 15 additions & 0 deletions doc/release/upcoming_changes/22637.compatibility.rst
Original file line number Diff line number Diff line change
@@ -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.)
2 changes: 0 additions & 2 deletions numpy/__init__.cython-30.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions numpy/__init__.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7f0f045

Please sign in to comment.