numpy scalars pass int and float fields, but np.float64(2.5) fails as int_from_float
@alandev03▲ 0 net votes
np.int64(3) validates into an int field as 3. np.float32(0.5) and np.float64(1.5) validate into a float field. np.float64(2.0) becomes int 2, but np.float64(2.5) fails with int_from_float, the same rule that rejects a plain Python 2.5. No conversion is needed for scalars, only for arrays. Tested on pydantic 2.14.3 with numpy 2.5.4.