Repository navigation
Conversation
Closes numpy#5801. PyLong types are only converted to npy_longlong if it is larger than npy_long.
|
I don't really object to the patch, but this kinda seems like a lot of code to produce exactly equivalent results (all the checks are of the form "if a and b are different, use a, otherwise if they're identical, use b", right?). To me it looks like in #5801 the real underlying bug is that we have two different types that pretend to be identical but aren't quite. Would it make more sense to fix things at that level? |
|
I tried the shortcut of, right after the declaration of the but it breaks a gazillion switch statements that have cases for all the types. I'm afraid that it is too deeply ingrained in the code that |
|
Yeah, that would also break abi. But what about, say, teaching dtype.eq
|
|
I have taken a second look into this, and it really seems there is no way out of not using
This is not enough to stop this: from returning a correct, yet awfully confusing result. Especially given that: So really the only valid solution is making sure that we always issue the smallest numbered type that fits the requested size, which is what this PR attempts to do. |
|
Sorry to be annoying but... we need to continue to recognize both |
|
@njsmith np.longlong refers to the C type, so changing that can cause problems. I'd be happy to remove the C long long altogether from our stuff, except where needed for the CPython ABI, but that could still lead to compatibility problems. |
|
In my suggestion np.longlong would still refer to the c long long type, so
|
|
The problem is that, in most systems, we have two internal types competing for the I guess I don't fully understand what the ABI constraints are here, which makes it hard to come up with alternatives. |
|
Yeah, NVM, I was thinking |
|
I guess in practice "long long" is probably 64 bits on all platforms we
|
|
Actually, I'd like to get rid of long except for Python API access. In practice long is either the same as either c |
|
Going to close this, PyLong is gone with Python 2.7. The use of C long/long long is still under discussion, but this is not the best place for that. |
|
Looks like all the code in this PR is in removed |
Closes #5801.
PyLong types are only converted to npy_longlong if it is larger
than npy_long.