Skip to content

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

Merged
seberg merged 1 commit into
numpy:masterfrom
kritisingh1:dep1
Jul 22, 2019
Merged

seberg merged 1 commit into
numpy:masterfrom
kritisingh1:dep1

Conversation

@kritisingh1

Copy link
Copy Markdown
Member

Related to #11521

@mattip

mattip commented Jul 17, 2019

Copy link
Copy Markdown
Member

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
Copy Markdown
Member Author

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

@mattip

mattip commented Jul 17, 2019

Copy link
Copy Markdown
Member

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
Copy Markdown
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

seberg commented Jul 22, 2019

Copy link
Copy Markdown
Member

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.

3 participants