5252
5353
5454/* forward declaration */
55- static PyObject *
55+ static NPY_INLINE PyObject *
5656promote_and_get_info_and_ufuncimpl (PyUFuncObject * ufunc ,
57- PyArrayObject * const ops [], PyArray_DTypeMeta * signature [],
58- PyArray_DTypeMeta * op_dtypes [], int do_legacy_fallback , int cache );
57+ PyArrayObject * const ops [],
58+ PyArray_DTypeMeta * signature [],
59+ PyArray_DTypeMeta * op_dtypes [],
60+ npy_bool allow_legacy_promotion , npy_bool cache );
5961
6062
6163/**
@@ -512,8 +514,10 @@ add_and_return_legacy_wrapping_ufunc_loop(PyUFuncObject *ufunc,
512514 */
513515static NPY_INLINE PyObject *
514516promote_and_get_info_and_ufuncimpl (PyUFuncObject * ufunc ,
515- PyArrayObject * const ops [], PyArray_DTypeMeta * signature [],
516- PyArray_DTypeMeta * op_dtypes [], int do_legacy_fallback , int cache )
517+ PyArrayObject * const ops [],
518+ PyArray_DTypeMeta * signature [],
519+ PyArray_DTypeMeta * op_dtypes [],
520+ npy_bool allow_legacy_promotion , npy_bool cache )
517521{
518522 /*
519523 * Fetch the dispatching info which consists of the implementation and
@@ -576,7 +580,7 @@ promote_and_get_info_and_ufuncimpl(PyUFuncObject *ufunc,
576580 * However, we need to give the legacy implementation a chance here.
577581 * (it will modify `op_dtypes`).
578582 */
579- if (!do_legacy_fallback || ufunc -> type_resolver == NULL ||
583+ if (!allow_legacy_promotion || ufunc -> type_resolver == NULL ||
580584 (ufunc -> ntypes == 0 && ufunc -> userloops == NULL )) {
581585 /* Already tried or not a "legacy" ufunc (no loop found, return) */
582586 return NULL ;
@@ -589,7 +593,7 @@ promote_and_get_info_and_ufuncimpl(PyUFuncObject *ufunc,
589593 return NULL ;
590594 }
591595 info = promote_and_get_info_and_ufuncimpl (ufunc ,
592- ops , signature , new_op_dtypes , 0 , cacheable );
596+ ops , signature , new_op_dtypes , NPY_FALSE , cacheable );
593597 for (int i = 0 ; i < ufunc -> nargs ; i ++ ) {
594598 Py_XDECREF (new_op_dtypes );
595599 }
@@ -619,8 +623,11 @@ promote_and_get_info_and_ufuncimpl(PyUFuncObject *ufunc,
619623 */
620624NPY_NO_EXPORT PyArrayMethodObject *
621625promote_and_get_ufuncimpl (PyUFuncObject * ufunc ,
622- PyArrayObject * const ops [], PyArray_DTypeMeta * signature [],
623- PyArray_DTypeMeta * op_dtypes [], int force_legacy_promotion )
626+ PyArrayObject * const ops [],
627+ PyArray_DTypeMeta * signature [],
628+ PyArray_DTypeMeta * op_dtypes [],
629+ npy_bool force_legacy_promotion ,
630+ npy_bool allow_legacy_promotion )
624631{
625632 int nargs = ufunc -> nargs ;
626633
@@ -654,7 +661,7 @@ promote_and_get_ufuncimpl(PyUFuncObject *ufunc,
654661 }
655662
656663 PyObject * info = promote_and_get_info_and_ufuncimpl (ufunc ,
657- ops , signature , op_dtypes , 1 , 1 );
664+ ops , signature , op_dtypes , allow_legacy_promotion , NPY_TRUE );
658665
659666 if (info == NULL ) {
660667 if (!PyErr_Occurred ()) {
0 commit comments