numpy / numpy/numpy

BUG: comparison of np.void with memoryview hits unreachable error

Open
#23,419 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

00 - Bug
Dominant language
Python
Stars
32.8k
Forks
12.8k
Avg merge
1d 7h
Merged PRs (30d)
197

Description

Describe the issue:

When comparing np.void against a memoryview results in "TypeError: Cannot compare structured with unstructured void arrays. (unreachable error, please report to NumPy devs.)".

Reproduce the code example:
import numpy as np
memoryview(np.void(4)) == np.void(4)  # this works
np.void(4) == memoryview(np.void(4))  # this excepts
Error message:
>>> np.void(4) == memoryview(np.void(4))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Cannot compare structured with unstructured void arrays. (unreachable error, please report to NumPy devs.)
Runtime information:

import sys, numpy; print(numpy.version); print(sys.version)
1.24.2
3.10.7 (tags/v3.10.7-dirty:6cc6b13308, Sep 12 2022, 08:30:52) [GCC 9.4.0]

print(numpy.show_runtime())
WARNING: threadpoolctl not found in system! Install it by pip install threadpoolctl. Once installed, try np.show_runtime again for more detailed build information
[{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'AVX2'],
'not_found': ['F16C',
'FMA3',
'AVX512F',
'AVX512CD',
'AVX512_KNL',
'AVX512_KNM',
'AVX512_SKX',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL']}}]
None

Context for the issue:

Not a priority, just doing my duty and reporting to NumPy devs as requested in the error message.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided np.void and memoryview comparison examples on the current NumPy version, then trace the comparison path responsible for the unreachable TypeError. No source file or test is named in the issue; done means the reversed comparison no longer raises that error and a regression test covers both comparison directions.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.