8000 BUG: Segmentation fault when doing a "Bitwise OR" on a `np.longdouble` with a `None` value · Issue #26767 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: Segmentation fault when doing a "Bitwise OR" on a np.longdouble with a None value #26767

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

Closed
BergLucas opened this issue Jun 20, 2024 · 2 comments · Fixed by #26904
Closed

Comments

@BergLucas
Copy link

Describe the issue:

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:

import numpy

numpy.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]

Runtime Environment:

[{'numpy_version': '2.0.0',
'python': '3.10.14 (main, Mar 21 2024, 16:24:04) [GCC 11.2.0]',
'uname': uname_result(system='Linux', node='lucas-hp', release='6.8.11-200.fc39.x86_64', version='#1 SMP PREEMPT_DYNAMIC Sun May 26 20:05:41 UTC 2024', machine='x86_64')},
{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2'],
'not_found': ['AVX512F',
'AVX512CD',
'AVX512_KNL',
'AVX512_KNM',
'AVX512_SKX',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL']}},
{'architecture': 'Zen',
'filepath': '/home/lucas/.conda/envs/pynguin-for-ML-libraries/lib/python3.10/site-packages/numpy.libs/libscipy_openblas64_-99b71e71.so',
'internal_api': 'openblas',
'num_threads': 12,
'prefix': 'libscipy_openblas',
'threading_layer': 'pthreads',
'user_api': 'blas',
'version': '0.3.27'}]

Context for the issue:

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.

@eendebakpt
Copy link
Contributor

I can confirm the bug under Windows. Also with a bitwise &.

@charris charris added this to the 2.0.1 release milestone Jun 25, 2024
@seberg
Copy link
Member
seberg commented 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 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).

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 a pull request may close this issue.

4 participants
0