-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
API: Switch to NEP 50 behavior by default #23912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
197e61c
af5fe2e
14f6aa1
0cc124d
e19fd64
1f07c93
e445e80
346a146
166e806
6cf68f3
623e0f0
0f18c6f
94b7f90
841a280
09418fc
df8f9d6
8a1497f
0aa93fa
375de5d
0e6d569
a907624
dcb8de2
6707f39
ba47e60
bf0ff21
35e105f
b5c8398
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3254,6 +3254,7 @@ PyArray_Where(PyObject *condition, PyObject *x, PyObject *y) | |
{ | ||
PyArrayObject *arr, *ax, *ay = NULL; | ||
PyObject *ret = NULL; | ||
PyArray_Descr *common_dt = NULL; | ||
|
||
arr = (PyArrayObject *)PyArray_FROM_O(condition); | ||
if (arr == NULL) { | ||
|
@@ -3295,23 +3296,20 @@ PyArray_Where(PyObject *condition, PyObject *x, PyObject *y) | |
NPY_ITER_READONLY | NPY_ITER_ALIGNED, | ||
NPY_ITER_READONLY | NPY_ITER_ALIGNED | ||
}; | ||
PyArray_Descr * common_dt = PyArray_ResultType(2, &op_in[2], | ||
0, NULL); | ||
common_dt = PyArray_ResultType(2, &op_in[2], 0, NULL); | ||
ngoldbaum marked this conversation as resolved.
Show resolved
Hide resolved
|
||
PyArray_Descr * op_dt[4] = {common_dt, PyArray_DescrFromType(NPY_BOOL), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Couldn't hurt to add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, we really should probably just have a name for it... |
||
common_dt, common_dt}; | ||
NpyIter * iter; | ||
NPY_BEGIN_THREADS_DEF; | ||
|
||
if (common_dt == NULL || op_dt[1] == NULL) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might as well move these failures up to single tests right after definition
mhvk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Py_XDECREF(op_dt[1]); | ||
Py_XDECREF(common_dt); | ||
goto fail; | ||
} | ||
iter = NpyIter_MultiNew(4, op_in, flags, | ||
NPY_KEEPORDER, NPY_UNSAFE_CASTING, | ||
op_flags, op_dt); | ||
iter = NpyIter_MultiNew( | ||
4, op_in, flags, NPY_KEEPORDER, NPY_UNSAFE_CASTING, | ||
op_flags, op_dt); | ||
Py_DECREF(op_dt[1]); | ||
Py_DECREF(common_dt); | ||
if (iter == NULL) { | ||
goto fail; | ||
} | ||
|
@@ -3420,6 +3418,7 @@ PyArray_Where(PyObject *condition, PyObject *x, PyObject *y) | |
Py_DECREF(arr); | ||
Py_DECREF(ax); | ||
Py_DECREF(ay); | ||
Py_DECREF(common_dt); | ||
NPY_cast_info_xfree(&cast_info); | ||
|
||
if (NpyIter_Deallocate(iter) != NPY_SUCCEED) { | ||
|
@@ -3433,6 +3432,7 @@ PyArray_Where(PyObject *condition, PyObject *x, PyObject *y) | |
Py_DECREF(arr); | ||
Py_XDECREF(ax); | ||
Py_XDECREF(ay); | ||
Py_XDECREF(common_dt); | ||
NPY_cast_info_xfree(&cast_info); | ||
return NULL; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well initialize all of these to
NULL
, leaving it like this is a little confusingThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added, although I can't say I prefer it when it isn't needed for cleanup (the "uninitialized" warnings work pretty well anyway).