Skip to content
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

DEP: Raise warnings for deprecated functions PyArray_As1D, PyArray_As2D #14036

Merged
merged 1 commit into from
Jul 22, 2019

Conversation

kritisingh1
Copy link
Member

Related to #11521

@mattip
Copy link
Member

mattip commented Jul 17, 2019

Unfortunately we really cannot remove these from numpy/core/code_generators/numpy_api.py until we release a Numpy2 (which may never happen) as it breaks backward compatibility. We can only raise an exception in the C code if the functions are called.

@kritisingh1 kritisingh1 changed the title Remove deprecated functions PyArray_As1D, PyArray_As2D [DOC] Raise warnings for deprecated functions PyArray_As1D, PyArray_As2D Jul 17, 2019
@kritisingh1 kritisingh1 added 07 - Deprecation 63 - C API Changes or additions to the C API. Mailing list should usually be notified. labels Jul 17, 2019
@kritisingh1
Copy link
Member Author

My bad, @mattip how do we deal with raising exceptions in C side of functions, any previous PR or example?

@mattip
Copy link
Member

mattip commented Jul 17, 2019

The return value will be different from each function, and in the general case there may be cleanup to be done (not in this simple case). Since there is no DeprecationError I propose raising a NotImplementedError like this:

PyErr_SetString(PyExc_NotImplementedError, msg);
return <errorval>;

@kritisingh1
Copy link
Member Author

I'm not sure how to go ahead with this since the travis builds are failing due to reasons jargon to me. Based on a discussion with @seberg recently, builds are failing due to presence of unused lines of code in the functions being deprecated. A possible solution is to just set the error message and return -1, and omit all other lines in the body of function. Should I try this?

@kritisingh1 kritisingh1 changed the title [DOC] Raise warnings for deprecated functions PyArray_As1D, PyArray_As2D [DEP] Raise warnings for deprecated functions PyArray_As1D, PyArray_As2D Jul 21, 2019
@seberg
Copy link
Member

seberg commented Jul 22, 2019

OK, lets put this in now that the tests pass. thanks Kriti.

@seberg seberg changed the title [DEP] Raise warnings for deprecated functions PyArray_As1D, PyArray_As2D DEP: Raise warnings for deprecated functions PyArray_As1D, PyArray_As2D Jul 22, 2019
@seberg seberg merged commit 49fbbbf into numpy:master Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
07 - Deprecation 63 - C API Changes or additions to the C API. Mailing list should usually be notified.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants