You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: Segmentation fault when doing a "Bitwise OR" on a np.longdouble with a None value #26767
I was working on Pynguin, an automated unit test generation tool for Python, and the tool found that Numpy creates a segmentation fault when doing a "Bitwise OR" on a np.longdouble with a None value.
Reproduce the code example:
importnumpynumpy.longdouble() |None
Error message:
Segmentation fault (core dumped)
Python and NumPy Versions:
2.0.0
3.10.14 (main, Mar 21 2024, 16:24:04) [GCC 11.2.0]
It's not a particularly serious bug, but an exception is thrown when the same code is run with a np.double, so fixing the bug might be a good idea to make it more user-friendly in the event of a user error and to make it more consistent with other Numpy types.
Just to note: This is not a regression. The reason is an infinite recursion due to NumPy being opportunistic when it comes to object dtype loops and that doesn't work for longdouble.
A bit annoying, "scalarmath" has appropriate logic, but the generic implementation that just forwards it to the array one doesn't.
(There is likely no ideal logic, it would almost be nice to just notice the recursion directly, or maybe even put the logic into the ufunc loop. The problem is that the broken logic makes some other things magically work and we would break those by changing it the easy way).
Activity
eendebakpt commentedon Jun 23, 2024
I can confirm the bug under Windows. Also with a bitwise
&.seberg commentedon Jun 25, 2024
Just to note: This is not a regression. The reason is an infinite recursion due to NumPy being opportunistic when it comes to
objectdtype loops and that doesn't work for longdouble.A bit annoying, "scalarmath" has appropriate logic, but the generic implementation that just forwards it to the array one doesn't.
(There is likely no ideal logic, it would almost be nice to just notice the recursion directly, or maybe even put the logic into the ufunc loop. The problem is that the broken logic makes some other things magically work and we would break those by changing it the easy way).