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
Bitwise Operations on numpy.int32 and int have different result types in macOS vs Windows, but same dtype __repr__ #17351
On macOS
1.19.1 3.7.8 | packaged by conda-forge | (default, Jul 23 2020, 03:39:37)
[Clang 10.0.0 ]
and
1.19.1 3.8.5 | packaged by conda-forge | (default, Sep 16 2020, 17:43:11)
[Clang 10.0.1 ]
On Windows
1.19.1 3.7.7 (default, May 6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)]
and
1.19.1 3.8.5 | packaged by conda-forge | (default, Sep 16 2020, 17:19:16) [MSC v.1916 64 bit (AMD64)]
The danger of changing dtype.__repr__ is that the array repr no longer round-trips to a platform-guaranteed memory layout. Perhaps the rarity of platforms where this matters makes this point moot.
@BvB93, I'd recommend you perform your tests with the canonical char, short, intc, int_, longlong names so that you don't accidentally miss a type.
Good to know, I'll keep it in mind for next time.
Still, what I find somewhat concerning is the discrepancy between the output (d)type of >0D arrays
versus those from 0D arrays/integers.
EDIT: Nevermind the last part, this behavior is clearly documented in the np.result_typedocs.
Activity
BvB93 commentedon Sep 19, 2020
Some further testing shows that there are some serious inconsistencies here between integers, 0D arrays and >0D arrays:
Numpy: 1.20.0.dev0+9e63ecf
Python: 3.8.5 | packaged by conda-forge | (default, Jul 31 2020, 01:53:45) [MSC v.1916 64 bit (AMD64)]
eric-wieser commentedon Sep 19, 2020
@BvB93, I'd recommend you perform your tests with the canonical
char, short, intc, int_, longlongnames so that you don't accidentally miss a type.eric-wieser commentedon Sep 19, 2020
The danger of changing
dtype.__repr__is that the array repr no longer round-trips to a platform-guaranteed memory layout. Perhaps the rarity of platforms where this matters makes this point moot.BvB93 commentedon Sep 19, 2020
Good to know, I'll keep it in mind for next time.
Still, what I find somewhat concerning is the discrepancy between the output (d)type of >0D arraysversus those from 0D arrays/integers.
EDIT: Nevermind the last part, this behavior is clearly documented in the
np.result_typedocs.