You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
.dtype.type class object is not preserved over some operations #11020
This is probably related to #10151. There's a fifth integer type that's not in your list there - you should iterate over [np.byte, np.short, np.intc, np.int_, np.longlong] + [np.ubyte, np.ushort, np.uintc, np.uint, np.ulonglong] to hit all the types
In my opinion, we should swap between these which one passes and which fails.
We're being inconsistent about when we pick long and when we pick long long for int64 on linux. By name, long takes precedence - but it seems that when assigning dtypes to scalars based on their value, we prefer long long.
On windows, it seems we handle int vs long for int32 consistently.
Yeah, the bug is that it falls to the unsigned path, and that fallback does not convert the original typenum to its unsigned version, but instead always uses ulonglong. If you use .min instead of max, it works ;).
The above is still there, I don't want to consider it a serious bug and NEP 50 adoption means that the repro's now all pass, since we ignore the oddity of the Python integer size now. (i.e. the path still exists, but it isn't hit here)
Activity
eric-wieser commentedon Apr 30, 2018
This is probably related to #10151. There's a fifth integer type that's not in your list there - you should iterate over
[np.byte, np.short, np.intc, np.int_, np.longlong] + [np.ubyte, np.ushort, np.uintc, np.uint, np.ulonglong]to hit all the typeseric-wieser commentedon Sep 13, 2019
A better test now that gh-10151 is in:
On 64 bit windows, this works as expected:
Can someone test this on linux (where
int_is 64-bit not 32-bit)?seberg commentedon Sep 13, 2019
Output on 64bit linux:
eric-wieser commentedon Sep 13, 2019
Does replacing
np.iinfo(dt).maxwith2give the same results? Would be nice to narrow down the issueseberg commentedon Sep 13, 2019
Ah, did not look at it carefully. Yes, that will fix things,
seberg commentedon Sep 13, 2019
To be clear: Replacing by two gives the correct output (i.e. no
Falseprints).eric-wieser commentedon Sep 13, 2019
Just fired up WSL with numpy 1.11 (!), and I think I can pinpoint the bug:
In my opinion, we should swap between these which one passes and which fails.
We're being inconsistent about when we pick
longand when we picklong longfor int64 on linux. By name,longtakes precedence - but it seems that when assigning dtypes to scalars based on their value, we preferlong long.On windows, it seems we handle
intvslongforint32consistently.seberg commentedon Sep 13, 2019
Yeah, the bug is that it falls to the unsigned path, and that fallback does not convert the original typenum to its unsigned version, but instead always uses ulonglong. If you use
.mininstead of max, it works ;).seberg commentedon Nov 3, 2023
The above is still there, I don't want to consider it a serious bug and NEP 50 adoption means that the repro's now all pass, since we ignore the oddity of the Python integer size now. (i.e. the path still exists, but it isn't hit here)