scikit-hep / uproot5

ROOT I/O in pure Python and NumPy.
https://uproot.readthedocs.io
BSD 3-Clause "New" or "Revised" License
239 stars 76 forks source link

Missing attribute in __array__ method of STLVector #1324

Closed rossodisera closed 4 weeks ago

rossodisera commented 1 month ago

Commit #cdaf9a7 adds an array method to STLVector in containers.py L1544 and L1659.

However, the method tries to return an attribute that does not exist. I think it should return self._values and not self._vector

def __array__(self, *args, **kwargs):
    return numpy.asarray(self._vector, *args, **kwargs)

should be:

def __array__(self, *args, **kwargs):
    return numpy.asarray(self._values, *args, **kwargs)

I tried to fix it with a small change in PR 1323