NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays
mrogowski opened this issue · comments
How should we handle this change in NumPy's behavior?
/shmem4py/test/test_rma.py:21: DeprecationWarning: NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays. The conversion of -1 to uint16 will fail in the future.
For most cases we can replace:
self.assertEqual(val, np.array(-1, dtype=t))
with self.assertEqual(val, np.array(-1).astype(t))
to keep the old behavior. Does that look good, @dalcinl?
How should we handle the case when shmem.array()
gets a negative value with an unsigned data type? Should we mirror NumPy's behavior and throw a warning for now?
np.array(-1).astype(t)
Yes, that's the proper fix.
How should we handle the case when
shmem.array()
gets a negative value with an unsigned data type?
Maybe do nothing? Look at the code, NumPy will do the work for us.
Fixed in f79cf38.