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

ENH: review return values for PyArray_DescrNew #20984

Merged
merged 1 commit into from Feb 3, 2022

Conversation

charris
Copy link
Member

@charris charris commented Feb 2, 2022

Backport of #20960.

  • ENH: review return value from PyArray_DescrNew* calls

  • BUG: remove unused variable

  • BUG: typo

  • Update numpy/core/src/multiarray/methods.c

Co-authored-by: Sebastian Berg sebastian@sipsolutions.net

  • Update numpy/core/src/multiarray/methods.c

Co-authored-by: Sebastian Berg sebastian@sipsolutions.net

  • Update numpy/core/src/multiarray/getset.c

Co-authored-by: Sebastian Berg sebastian@sipsolutions.net

  • Update numpy/core/src/multiarray/methods.c

Co-authored-by: Sebastian Berg sebastian@sipsolutions.net

  • fixes from review

  • Update numpy/core/src/umath/ufunc_type_resolution.c

Co-authored-by: Sebastian Berg sebastian@sipsolutions.net

  • move check to internal function

  • remove check

  • Remove unnecessary dealloc

The dealloc is now part of the Py_DECREF(ret) and handled there.
Doing it here would decref it twice.

  • MAINT: Remove custom error message (and small cleanup)

It is probably not good to call PyObject_GetIter() if dtype is NULL
and an error is already in progress...
(If we check for it, lets try to do it right.)

  • Fixup DescrNewFromType

DescrNewFromType cannot fail in most cases, but if it does,
DescrNew does not accept NULL as input.

Co-authored-by: Sebastian Berg sebastian@sipsolutions.net

* ENH: review return value from PyArray_DescrNew* calls

* BUG: remove unused variable

* BUG: typo

* Update numpy/core/src/multiarray/methods.c

Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>

* Update numpy/core/src/multiarray/methods.c

Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>

* Update numpy/core/src/multiarray/getset.c

Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>

* Update numpy/core/src/multiarray/methods.c

Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>

* fixes from review

* Update numpy/core/src/umath/ufunc_type_resolution.c

Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>

* move check to internal function

* remove check

* Remove unnecessary dealloc

The dealloc is now part of the Py_DECREF(ret) and handled there.
Doing it here would decref it twice.

* MAINT: Remove custom error message (and small cleanup)

It is probably not good to call PyObject_GetIter() if dtype is NULL
and an error is already in progress...
(If we check for it, lets try to do it right.)

* Fixup DescrNewFromType

`DescrNewFromType` cannot fail in most cases, but if it does,
DescrNew does not accept NULL as input.

Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
@charris charris added 01 - Enhancement 08 - Backport Used to tag backport PRs labels Feb 2, 2022
@charris charris added this to the 1.22.2 release milestone Feb 2, 2022
@charris charris merged commit c12001c into numpy:maintenance/1.22.x Feb 3, 2022
@charris charris changed the title ENH: review return values for PyArray_DescrNew (#20960) ENH: review return values for PyArray_DescrNew Feb 3, 2022
@charris charris deleted the backport-20960 branch April 10, 2022 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
01 - Enhancement 08 - Backport Used to tag backport PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants