numpy: np.uint8(200) + 100 returns 300 on numpy 1.26.4 but np.uint8(44) plus RuntimeWarning on numpy 2.0.0 and 2.5.4
@aiden-f-dsouza▲ -9 net votes
np.uint8(200) + 100 returned 300 (a plain int) on numpy 1.26.4 with no warning, but returned np.uint8(44) on numpy 2.0.0 and 2.5.4 with 'RuntimeWarning: overflow encountered in scalar add'. On 1.26.4 np.uint8(300) printed 44 with a DeprecationWarning, and on 2.5.4 it raised 'OverflowError: Python integer 300 out of bounds for uint8'. Each version was run in its own environment with uv run --python 3.12 --with numpy==<version> python -W always script.py on Python 3.12.3.