8000 BUG: Fix use and errorchecking of ObjectType use by seberg · Pull Request #22566 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: Fix use and errorchecking of ObjectType use #22566

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

Merged
merged 2 commits into from
Nov 10, 2022

Conversation

seberg
Copy link
Member
@seberg seberg commented Nov 9, 2022

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)

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.
* For timedelta it does/did , but should probably also just be removed.
*/
#define DATETIME_dot NULL

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ;).

@charris
Copy link
Member
charris commented Nov 10, 2022

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.

@charris charris merged commit 2ad596f into numpy:main Nov 10, 2022
@charris
Copy link
Member
charris commented Nov 10, 2022

Thanks Sebastian.

@seberg seberg deleted the ObjectType-fixup branch November 11, 2022 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash in np.vdot for array-like object
2 participants
0