Skip to content

np.ndindex fails with TypeError: data type "<%c<%c60" not understood #252

@blu3r4y

Description

@blu3r4y

Hi! 👋 I found a bug when using np.ndindex that can be easily reproduced like so.

import numpy as np

a = np.zeros((2, 3))

for x, y in np.ndindex(a.shape):
    print(x, y)

Expected output

0 0
0 1
0 2
1 0
1 1
1 2

Actual output

Traceback (most recent call last):
  File "/mnt/c/data/Dropbox/git/AdventOfCode2021/src/minimal.py", line 5, in <module 'minimal.py'>
    for x, y in np.ndindex(a.shape):
  File "/home/blu3r4y/.graalpython3.8/lib/python3.8/site-packages/numpy-1.16.4-py3.8-linux-x86_64.egg/numpy/lib/index_tricks.py", line 637, in __init__
    x = as_strided(_nx.zeros(1), shape=shape,
  File "/home/blu3r4y/.graalpython3.8/lib/python3.8/site-packages/numpy-1.16.4-py3.8-linux-x86_64.egg/numpy/lib/stride_tricks.py", line 103, in as_strided
    array = np.asarray(DummyArray(interface, base=x))
  File "/home/blu3r4y/.graalpython3.8/lib/python3.8/site-packages/numpy-1.16.4-py3.8-linux-x86_64.egg/numpy/core/numeric.py", line 538, in asarray
    return array(a, dtype, copy=False, order=order)
TypeError: data type "<%c<%c60" not understood

Environment information

  • NumPy 1.16.4 was installed as recommend via graalpython -m ginstall install numpy
  • Python 3.8.5
  • GraalVM CE Native 21.3.0
  • Windows WSL 2 on Ubuntu 20.04.3 LTS with kernel Linux 4.19.104-microsoft-standard

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions