Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.bugs.dist > #1270726 > unrolled thread

Bug#1120971: powerpc: _ctype_from_dtype_scalar NotImplementedError: Converting dtype('int32') to a ctypes type

Started byDrew Parsons <dparsons@debian.org>
First post2025-11-18 22:50 +0100
Last post2025-11-19 12:50 +0100
Articles 2 — 1 participant

Back to article view | Back to linux.debian.bugs.dist


Contents

  Bug#1120971: powerpc: _ctype_from_dtype_scalar NotImplementedError: Converting dtype('int32') to a ctypes type Drew Parsons <dparsons@debian.org> - 2025-11-18 22:50 +0100
    Bug#1120971: powerpc: _ctype_from_dtype_scalar NotImplementedError: Converting dtype('int32') to a ctypes type Drew Parsons <dparsons@debian.org> - 2025-11-19 12:50 +0100

#1270726 — Bug#1120971: powerpc: _ctype_from_dtype_scalar NotImplementedError: Converting dtype('int32') to a ctypes type

FromDrew Parsons <dparsons@debian.org>
Date2025-11-18 22:50 +0100
SubjectBug#1120971: powerpc: _ctype_from_dtype_scalar NotImplementedError: Converting dtype('int32') to a ctypes type
Message-ID<LSBKh-dYBl-5@gated-at.bofh.it>
Source: numpy
Version: 1:2.3.4+ds-3
Severity: normal
X-Debbugs-Cc: debian-powerpc@lists.debian.org
User: debian-powerpc@lists.debian.org
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)

[toc] | [next] | [standalone]


#1270779

FromDrew Parsons <dparsons@debian.org>
Date2025-11-19 12:50 +0100
Message-ID<LSORb-e7uG-5@gated-at.bofh.it>
In reply to#1270726
Source: numpy
Version: 1:2.3.4+ds-3
Followup-For: Bug #1120971
X-Debbugs-Cc: debian-powerpc@lists.debian.org
User: debian-powerpc@lists.debian.org
Usertags: powerpc
Control: tags -1 patch

Upstream has identified a probable patch
https://github.com/numpy/numpy/issues/30257#issuecomment-3552193179

" We changed the elsize to be an ssize_t but the code here is using i
conversion to convert from Python.

If you want to try a hot-fix, this code is here:

numpy/numpy/_core/src/multiarray/hashdescr.c

Line 82 in 8eb840a
 t = Py_BuildValue("(cccii)", descr->kind, nbyteorder, 
 
 The i both need to be n.
 
 Not sure about the ABI for variable function parameters in the case
of integers, but I guess it is very plausible for that getting mangled
up on some systems."

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.bugs.dist


csiph-web