-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
TST: Add tests for deprecated C functions (PyArray_As1D, PyArray_As1D) #14223
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
Conversation
042ea28
to
1f74c8b
Compare
PyObject* temp = PyArray_As2D((PyObject **)&arg1, (char ***)&arg2, (int *)4, (int *)6, NPY_DOUBLE); | ||
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.
the compiler is complaining that you never use temp
. Either return it or call Py_DECREF(temp)
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.
The interface to PyArray_AsCArray
is very strange - it modifies the first argument, replacing it with the result of PyArray_FromAny
but only if it returns success. In the tests this doesn't matter, since the first argument is a valid ndarray so the value returned from PyArray_FromAny
is the same as the input, but in these tests (if successful) it would have changed result
.
All that is irrelevant since the deprecated functions fail, but I tried to use a correct approach for the unused branch anyway.
9091d76
to
1740a75
Compare
0ee2c50
to
98f079a
Compare
Since #14036 did not add a release note, this PR should |
Have updated the PR with release notes, though shippable builds are failing. |
PyObject **result = Py_BuildValue("i", 42); | ||
int dim = 4; | ||
double arg[2] = {1, 2}; | ||
int temp = PyArray_As1D(result, (char **)&arg, &dim, NPY_DOUBLE); |
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.
Define result
as PyObject *
and use &result
here. (and below) The shippable tests are just broken, but the Travis failures are real due to compiler warnings.
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.
My bad, I overwrote Matti's changes by force-pushing the commit without pulling :(
d0debc9
to
49a66ce
Compare
Thanks @kritisingh1 |
Followup to #14036 , related to #11521