Skip to content

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.

2 participants