SIGN IN SIGN UP

BUG: pass DType class (not instance) to ufunc in `_unsigned_subtract` (#31447)

np.histogram raises TypeError: Cannot pass a new user DType instance to the dtype or signature arguments of ufuncs. Pass the DType class instead. for any non-legacy user DType e.g. numpy-quaddtype

Root cause: _unsigned_subtract in numpy/lib/_histograms_impl.py passes dtype=dt (a DType instance from np.result_type) to np.subtract. For legacy/built-in DTypes the dispatcher silently converts instance to class, but for new user DTypes the dispatcher rejects instances by design (seeufunc_object.c::_get_dtype, comment at ufunc_object.c:3954-3958).
S
Swayam committed
5f4ce33cb0e4e37c98c257aebdd71bc7932b2115
Parent: d5b13bf
Committed by GitHub <noreply@github.com> on 5/19/2026, 3:25:35 PM