Skip to content

fix: Only dispatch requests to Source if we actually will use them #1436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/uproot/behaviors/TBranch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3096,8 +3096,6 @@ def _ranges_or_baskets_to_arrays(
):
branchid_to_branch[cache_key]._awkward_check(interpretation)

hasbranches._file.source.chunks(ranges, notifications=notifications)

def replace(ranges_or_baskets, original_index, basket):
branch, basket_num, range_or_basket = ranges_or_baskets[original_index]
ranges_or_baskets[original_index] = branch, basket_num, basket
Expand Down Expand Up @@ -3176,6 +3174,13 @@ def basket_to_array(basket):
else:
notifications.put(None)

if len(arrays) == len(branchid_interpretation):
# all arrays are already in the cache
return

# Request all chunks and then poll notifications queue until we have all the arrays we expect
hasbranches._file.source.chunks(ranges, notifications=notifications)

while len(arrays) < len(branchid_interpretation):
obj = notifications.get()

Expand Down