diff --git a/src/coffea/nanoevents/factory.py b/src/coffea/nanoevents/factory.py index 40114d914..2118a9231 100644 --- a/src/coffea/nanoevents/factory.py +++ b/src/coffea/nanoevents/factory.py @@ -374,12 +374,10 @@ def from_root( if entry_start is None or entry_start < 0: entry_start = 0 - if entry_stop is None or entry_stop > tree.num_entries: - if treepath is not None: - # if treepath exists, attempt the faster uproot.num_entries method - entry_stop = next(uproot.num_entries(f"{file}:{treepath}"))[-1] - else: - entry_stop = tree.num_entries + # should use uproot.num_entries instead... + nentries = tree.num_entries + if entry_stop is None or entry_stop > nentries: + entry_stop = nentries partition_key = ( str(tree.file.uuid),