Skip to content

Commit 1d1c0c0

Browse files
committed
STY: Address review comments
1 parent 817c9e4 commit 1d1c0c0

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

numpy/_core/src/umath/dispatching.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ promote_and_get_info_and_ufuncimpl(PyUFuncObject *ufunc,
6565
PyArrayObject *const ops[],
6666
PyArray_DTypeMeta *signature[],
6767
PyArray_DTypeMeta *op_dtypes[],
68-
npy_bool allow_legacy_promotion);
68+
npy_bool legacy_promotion_is_possible);
6969

7070

7171
/**
@@ -760,7 +760,7 @@ promote_and_get_info_and_ufuncimpl(PyUFuncObject *ufunc,
760760
PyArrayObject *const ops[],
761761
PyArray_DTypeMeta *signature[],
762762
PyArray_DTypeMeta *op_dtypes[],
763-
npy_bool allow_legacy_promotion)
763+
npy_bool legacy_promotion_is_possible)
764764
{
765765
/*
766766
* Fetch the dispatching info which consists of the implementation and
@@ -829,7 +829,7 @@ promote_and_get_info_and_ufuncimpl(PyUFuncObject *ufunc,
829829
* However, we need to give the legacy implementation a chance here.
830830
* (it will modify `op_dtypes`).
831831
*/
832-
if (!allow_legacy_promotion || ufunc->type_resolver == NULL ||
832+
if (!legacy_promotion_is_possible || ufunc->type_resolver == NULL ||
833833
(ufunc->ntypes == 0 && ufunc->userloops == NULL)) {
834834
/* Already tried or not a "legacy" ufunc (no loop found, return) */
835835
return NULL;
@@ -940,7 +940,7 @@ promote_and_get_ufuncimpl(PyUFuncObject *ufunc,
940940
npy_bool ensure_reduce_compatible)
941941
{
942942
int nin = ufunc->nin, nargs = ufunc->nargs;
943-
npy_bool allow_legacy_promotion = NPY_TRUE;
943+
npy_bool legacy_promotion_is_possible = NPY_TRUE;
944944

945945
/*
946946
* Get the actual DTypes we operate with by setting op_dtypes[i] from
@@ -972,13 +972,13 @@ promote_and_get_ufuncimpl(PyUFuncObject *ufunc,
972972
if (op_dtypes[i] != NULL && !NPY_DT_is_legacy(op_dtypes[i]) && (
973973
signature[i] != NULL || // signature cannot be a pyscalar
974974
!(PyArray_FLAGS(ops[i]) & NPY_ARRAY_WAS_PYTHON_LITERAL))) {
975-
allow_legacy_promotion = NPY_FALSE;
975+
legacy_promotion_is_possible = NPY_FALSE;
976976
}
977977
}
978978

979979
int current_promotion_state = get_npy_promotion_state();
980980

981-
if (force_legacy_promotion && allow_legacy_promotion
981+
if (force_legacy_promotion && legacy_promotion_is_possible
982982
&& current_promotion_state == NPY_USE_LEGACY_PROMOTION
983983
&& (ufunc->ntypes != 0 || ufunc->userloops != NULL)) {
984984
/*
@@ -996,7 +996,7 @@ promote_and_get_ufuncimpl(PyUFuncObject *ufunc,
996996
/* Pause warnings and always use "new" path */
997997
set_npy_promotion_state(NPY_USE_WEAK_PROMOTION);
998998
PyObject *info = promote_and_get_info_and_ufuncimpl(ufunc,
999-
ops, signature, op_dtypes, allow_legacy_promotion);
999+
ops, signature, op_dtypes, legacy_promotion_is_possible);
10001000
set_npy_promotion_state(current_promotion_state);
10011001

10021002
if (info == NULL) {

numpy/_core/src/umath/ufunc_object.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5792,10 +5792,10 @@ ufunc_at(PyUFuncObject *ufunc, PyObject *args)
57925792
Py_INCREF(operand_DTypes[2]);
57935793

57945794
if ((PyArray_NDIM(op1_array) == 0)
5795-
!= (PyArray_NDIM(op2_array) == 0)) {
5796-
/* both are legacy and only one is 0-D: force legacy */
5797-
force_legacy_promotion = should_use_min_scalar(2, tmp_operands, 0, NULL);
5798-
}
5795+
!= (PyArray_NDIM(op2_array) == 0)) {
5796+
/* both are legacy and only one is 0-D: force legacy */
5797+
force_legacy_promotion = should_use_min_scalar(2, tmp_operands, 0, NULL);
5798+
}
57995799
}
58005800
else {
58015801
tmp_operands[1] = tmp_operands[0];

0 commit comments

Comments
 (0)