From 53f917c82daac2f07e9a600226a1c358783a1653 Mon Sep 17 00:00:00 2001 From: Andrea Serafini <46961664+rossodisera@users.noreply.github.com> Date: Thu, 31 Oct 2024 18:22:56 +0100 Subject: [PATCH] Fix for missing attribute in __array__ method of STLVector (#1323) Commit [#cdaf9a7](cdaf9a7) adds an __array__ method to STLVector in containers.py [L1544](https://github.com/scikit-hep/uproot5/blob/afca74c2af16641299abfbf91935e8010d601111/src/uproot/containers.py#L1544) and [L1659](https://github.com/scikit-hep/uproot5/blob/afca74c2af16641299abfbf91935e8010d601111/src/uproot/containers.py#L1659). However, the method tries to return an attribute that does not exist. I think it should return `self._values` and not `self._vector` ```python def __array__(self, *args, **kwargs): return numpy.asarray(self._vector, *args, **kwargs) ``` should be: ```python def __array__(self, *args, **kwargs): return numpy.asarray(self._values, *args, **kwargs) ``` Co-authored-by: Jim Pivarski --- src/uproot/containers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uproot/containers.py b/src/uproot/containers.py index 3506dee52..2093c229a 100644 --- a/src/uproot/containers.py +++ b/src/uproot/containers.py @@ -1541,7 +1541,7 @@ def __eq__(self, other): return False def __array__(self, *args, **kwargs): - return numpy.asarray(self._vector, *args, **kwargs) + return numpy.asarray(self._values, *args, **kwargs) def tolist(self): return [ @@ -1656,7 +1656,7 @@ def __eq__(self, other): return False def __array__(self, *args, **kwargs): - return numpy.asarray(self._vector, *args, **kwargs) + return numpy.asarray(self._values, *args, **kwargs) def tolist(self): return [