[ml_dtypes] Migrate custom dtype cross-dtype casts to ArrayMethod.
Previously, ml_dtypes registered cross-dtype casts and safe-cast rules through
the legacy NumPy 1.x PyArray_RegisterCastFunc and PyArray_RegisterCanCast APIs.
On NumPy 2.x, NumPy's legacy cast wrapper treated distinct custom dtypes that
shared a kind character and itemsize as safe casts, which also prevented
registering lossy casts between several 1-byte custom dtypes.
Register cross-dtype casts through PyArrayDTypeMeta_Spec::casts
(PyArrayMethod_Spec) with explicit NPY_CASTING levels instead:
- Register casts between all pairs of custom dtypes and all built-in numeric
dtypes with exact safe/same_kind/unsafe casting levels (including longlong and
ulonglong for sub-byte integers).
- Emit ComplexWarning once per cast via NPY_METH_get_loop so all cast loops run
without holding the GIL.
- Consistently return 0 and raise FE_INVALID when casting non-finite or
out-of-range floating-point values to integer dtypes.
PiperOrigin-RevId: 1009691260