You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We serialize some objects containing 2D int16_t arrays (these are waveforms). For our PyROOT interface, we convert them to numpy arrays using numpy.frombuffer.
Starting in ROOT 6.34, at least as distributed by Fedora and by EL9 EPEL, this no longer works. One-dimensional arrays seem fine.
Reproducer
Here is a standalone example exhibiting the problem
import cppyy
import cppyy.ll
import numpy
cppyy.cppdef("""
struct Foo {int16_t bar[24][2] = {};};
Foo foo;
foo.bar[0][0]=1;
foo.bar[10][1]=1;
for(int i = 0; i < 24; i++) { std::cout << foo.bar[i][0] << " " << foo.bar[i][1] << std::endl; }
""")
arr = cppyy.gbl.foo.bar
print(arr.shape)
print(arr.typecode)
print(arr.format)
# this cast was necessary for some reason in older ROOT versions, though it doesn't change anything here
a = numpy.frombuffer(cppyy.ll.cast['int16_t*'](arr), dtype='int16', count=24*2).reshape((24,2))
print(a)
Check duplicate issues.
Description
We serialize some objects containing 2D int16_t arrays (these are waveforms). For our PyROOT interface, we convert them to numpy arrays using numpy.frombuffer.
Starting in ROOT 6.34, at least as distributed by Fedora and by EL9 EPEL, this no longer works. One-dimensional arrays seem fine.
Reproducer
Here is a standalone example exhibiting the problem
This gives something like
Obviously the shape and typecode are wrong, and the array is garbage, when this used to work fine.
ROOT version
ROOT 6.34.04
Installation method
dnf
Operating system
Fedora and also EPEL9
Additional context
I reported this at cppyy, but apparently this is fine in current upstream cppyy.
The text was updated successfully, but these errors were encountered: