File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
src/boost_histogram/_internal Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -764,11 +764,10 @@ def __getitem__( # noqa: C901
764
764
765
765
# If this is (now) all integers, return the bin contents
766
766
# But don't try *dict!
767
- if not hasattr (indexes , "items" ):
768
- try :
769
- return self ._hist .at (* indexes ) # type: ignore[no-any-return]
770
- except RuntimeError :
771
- pass
767
+ if not hasattr (indexes , "items" ) and all (
768
+ isinstance (a , SupportsIndex ) for a in indexes
769
+ ):
770
+ return self ._hist .at (* indexes ) # type: ignore[no-any-return]
772
771
773
772
integrations : Set [int ] = set ()
774
773
slices : List [_core .algorithm .reduce_command ] = []
@@ -777,8 +776,8 @@ def __getitem__( # noqa: C901
777
776
778
777
# Compute needed slices and projections
779
778
for i , ind in enumerate (indexes ):
780
- if hasattr (ind , "__index__" ):
781
- pick_each [i ] = ind .__index__ () + ( # type: ignore[union-attr]
779
+ if isinstance (ind , SupportsIndex ):
780
+ pick_each [i ] = ind .__index__ () + (
782
781
1 if self .axes [i ].traits .underflow else 0
783
782
)
784
783
continue
You can’t perform that action at this time.
0 commit comments