BUG: Fix use and errorchecking of ObjectType use #22566
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This should be replaced really, it is pretty bad API use, and doesn't work well (up to being incorrect probably).
But working on other things (trying to make promotion strict and thus saner), I realized that the use was always wrong: we cannot pass 0 since 0 means
bool
, what was always meant was passing no-type.So fixing this, and adding the error check everywhere. Checking for
PyErr_Occurred()
may have been necessary at some point, but is not anymore.Closes gh-14247
Wasn't sure its worthwhile to cover the failure path in all of the occurances. In principle, I don't even like this pattern, but truly fixing this is probably for another day.
(I suspect I would need something like a
PyArray_ManyWithSameDescriptorFromAny
)