-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
segfault with extension dtype not defining nb_int #10693
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
Comments
Yep, looks like This is like the |
Did this happen in 1.13? It's possible I introduced this in #10042, or in the commit described here: #10042 (comment) |
Just tried 1.13.3; same problem. (I used a hacked up |
1.12? The Pr above was 1.14. but the comment within it references a 1.13 change |
Also crashes with 1.12.1. Again, same extension module source though. |
Different stack trace on 1.12 though: only |
Python 2 or 3? |
Python 3. |
Also likewise for A simple workaround is to point these two at functions that unconditionally raise |
Perhaps |
Ok, so here's the actual path:
Normally, I'm of the opinion that every internal use of |
Attempting to fix this opens the can of worms that is #9972 |
we should revisit this class of bugs once PR #10915 lands and we can refactor the code that set slots after calling |
Uh oh!
There was an error while loading. Please reload this page.
It appears that if you create an extension type that derives
PyGenericArrType
and doesn't definenb_int
, NumPy crashes when callingint()
on an instance of your type.This is straightforward to demonstrate with
test_rational.c
: replacepyrational_int
with 0 on line 631 when definingnb_int
. Then,This results in an infinite recursion. On OS/X, this is the bottom of the stack.
If the type doesn't subclass
PyGenericArrType
, this does not appear to occur.Similar failure and similar stack trace on Linux/GCC/gdb.
Tested on 1.14, 1.13, 1.12 (the latter has a different stack trace) with Python 3.
The text was updated successfully, but these errors were encountered: