-
-
Notifications
You must be signed in to change notification settings - Fork 12k
Closed
Milestone
Description
There is a difference in the operations of numpy.flatiter between little-endian versus big-endian machines. Specifically, the .index and .coords attributes update on the flatiter instances when little-endian, but not when big-endian.
CC: @pllim, @mhvk
See astropy/astropy#11804 and astropy/astropy#11806 for initial bug report and testing of the bug, respectively.
Reproducing code example:
import numpy as np
x = np.arange(6).reshape(3, 1, 2)
xf = x.flat
endindices = [(xf.index, xf.coords) for _ in xf][-2] # next() oversteps
assert endindices[0] == 5 # should be 5, will be 0 on big-endianThis test will only fail on big-endian machines
Error message:
AssertionError The value is 0, not 5.
NumPy/Python version information:
Platform: Linux-5.4.0-1047-azure-s390x-with-debian-10.9
Numpy : 1.20.3
Python: 3.7.3