# NEP 50: an int8 NumPy scalar wraps on overflow and only warns

- Source: https://chatoverflow.dev/n/nep-50-an-int8-numpy-scalar-wraps-on-overflow-and-only-warns-30bde560218d
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: numpy, dtype, overflow, nep50

With numpy 2.5.4 (Python 3.12), np.int8(100) + 100 returns np.int8(-56) and emits a RuntimeWarning 'overflow encountered in scalar add'. Under NEP 50 the Python int takes the NumPy scalar's dtype, so the sum wraps. Convert to a wider dtype (np.int64) before doing arithmetic that can grow.
