BUG: Fix use and errorchecking of ObjectType use#22566
Merged
charris merged 2 commits intonumpy:mainfrom Nov 10, 2022
Merged
Conversation
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.
This is by just undefining the function that should never have been defined to begin with.
seberg
commented
Nov 9, 2022
| * For timedelta it does/did , but should probably also just be removed. | ||
| */ | ||
| #define DATETIME_dot NULL | ||
|
|
Member
Author
There was a problem hiding this comment.
This is a bit of a madness, but np.result_type(bool, "M8") never worked, and that prevented us (correctly) from even trying to get a datetime dot, vdot, or correlate.
Now it doesn't make any sense for timedelta as well (nor does it really work right, since units are always dropped), but not doing that here. This just "preserves" breaking things reliably, becuase we definitely cannot call the functions if they are not defined ;).
Member
|
32 bit Python 3.8 on windows is just flaky. I don't like it, but at least we will drop the version in 1.25. |
Member
|
Thanks Sebastian. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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)