Source: numpy
Version: 1:2.3.4+ds-3
Severity: normal
X-Debbugs-Cc: [email protected]
User: [email protected]
Usertags: powerpc
Control: forwarded -1 https://github.com/numpy/numpy/issues/30257
Control: affects -1 src:fenics-dolfinx

Debian tests of dolfinx on powerpc have exposed an irregularity in ppc ctypes
https://buildd.debian.org/status/fetch.php?pkg=fenics-dolfinx&arch=powerpc&ver=1%3A0.10.0.post2-1exp2&stamp=1763496611&raw=0

/usr/lib/python3/dist-packages/numpy/ctypeslib.py:382: in 
_ctype_from_dtype_scalar
    raise NotImplementedError(
E   NotImplementedError: Converting dtype('int32') to a ctypes type

The failing line

numpy/numpy/ctypeslib/_ctypeslib.py

Line 385 in a251f2a
 ctype = _scalar_type_map[dtype_native] 

is simply trying to access a ctype for dtype int32.

The problem can be reproduced manually. The strange thing is that
inspecting the _scalar_type_map dict (on ppc), it clearly shows an
entry dtype('int32'): <class 'ctypes.c_long'>


import numpy as np
import platform
print("testing architecture", platform.machine())
a = np.array([1], dtype=np.int32)
dtype_native = a.dtype.newbyteorder('=')
print("'np.int32' is", dtype_native)
print("ctypeslib _scalar_type_map is", np.ctypeslib._scalar_type_map)
print(f"extract ctype for {dtype_native}:")
ctype = np.ctypeslib._scalar_type_map[dtype_native]
print("got ctype", ctype)

Reply via email to