Closed alexreinking closed 3 months ago
Numpy no longer automatically truncates Python integers to the destination type. So the following code causes an overflow error now:
input = np.empty((640, 480), dtype=np.uint8, order='F') for y in range(480): for x in range(640): input[x, y] = x ^ (y + 1)
We can recover the old behavior by manually masking.
input = np.empty((640, 480), dtype=np.uint8, order='F') for y in range(480): for x in range(640): input[x, y] = (x ^ (y + 1)) & 0xFF
Numpy no longer automatically truncates Python integers to the destination type. So the following code causes an overflow error now:
We can recover the old behavior by manually masking.