8000 MAINT: cleanup comments and harmless reference assignment · numpy/numpy@f73d96d · GitHub
[go: up one dir, main page]

Skip to content

Commit f73d96d

Browse files
committed
MAINT: cleanup comments and harmless reference assignment
1 parent 0267264 commit f73d96d

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

numpy/core/include/numpy/ufuncobject.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ typedef struct _tagPyUFuncObject {
120120
*/
121121
int nin, nout, nargs;
122122

123-
/* Identity for reduction, either PyUFunc_One or PyUFunc_Zero */
123+
/*
124+
* Identity for reduction, any of PyUFunc_One, PyUFunc_Zero
125+
* PyUFunc_MinusOne, PyUFunc_None, PyUFunc_ReorderableNone,
126+
* PyUFunc_IdentityValue.
127+
*/
124128
int identity;
125129

126130
/* Array of one-dimensional core loops */
@@ -301,7 +305,7 @@ typedef struct _tagPyUFuncObject {
301305
*/
302306
#define PyUFunc_ReorderableNone -2
303307
/*
304-
* UFunc unit is in identity_value, and the order of operations can be reordered
308+
* UFunc unit is an identity_value, and the order of operations can be reordered
305309
* This case allows reduction with multiple axes at once.
306310
*/
307311
#define PyUFunc_IdentityValue -3

numpy/core/src/umath/ufunc_object.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4908,8 +4908,10 @@ PyUFunc_FromFuncAndDataAndSignatureAndIdentity(PyUFuncGenericFunction *func, voi
49084908
ufunc->identity = identity;
49094909
if (ufunc->identity == PyUFunc_IdentityValue) {
49104910
Py_INCREF(identity_value);
4911+
ufunc->identity_value = identity_value;
4912+
} else {
4913+
ufunc->identity_value = NULL;
49114914
}
4912-
ufunc->identity_value = identity_value;
49134915

49144916
ufunc->functions = func;
49154917
ufunc->data = data;

0 commit comments

Comments
 (0)
0