Incompatibilities with array.array introduced in ROOT 6.32

Dear All,

Yet another serious incompatibility has been introduced in (Py)ROOT 6.32. This time, it is related to the interaction between std::vector and array.array module.

  1. vector+= array.array used to add contents before ROOT 6.32, now it changes the vector to an iterator
  2. vector+= or .assign() an empty array.array crashes on ROOT 6.32

Here is a script that shows both issues when I run it on my ROOT 6.30.06 and 6.32.02:


import ROOT
import array

v1 = ROOT.vector("int")()

a = array.array('i', [1])

# This produces an iterator on ROOT 6.32.02

print(v1, v1[0])

v1 = ROOT.vector("int")()


print(v1, v1[0])

b = array.array('i', [])

# This will crash on ROOT 6.32.02

In general, += seems to work only with lists now, while lists, unlike array.array or numpy.array do not hold as specific types as the former, like unsigned types, etc…

Dear @LeWhoo ,

Thanks for reaching out to the forum and for the report!

ROOT 6.32 moved to the latest status of the cppyy engine for the Python bindings, providing massive improvements on many fronts. Some incompatibilities such as the one you report might arise. I will try to reproduce your problem and then we can understand if the new behaviour should be modified/reverted.


Sure, I understand and I was really looking to 6.32. However, as you can see also in other very recent posts from me, I encounter serious problems (plural). There is a chance that you would agree, that if a framework had functionality X, and an upgrade gives it X/2 functionality, but faster, it is difficult to consider that an upgrade :slight_smile: And dropping compatibility with numpy and array modules is removing a huge chunk of very important functionality. I really hope that you agree with me and at least make workarounds inside PyROOT :slight_smile:

Just keeping this topic alive

Thank you very much for reporting this. I agree that this is not a sensible change in behavior.

I have opened an issue about this:

We’ll try to fix is upstream in cppyy, so that the fix can be propagated to one of the next ROOT versions.

Thanks again and cheers!

Thank you very much!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.