Skip to content

Commit

Permalink
Fix dataset ok property not being cached because of different name.
Browse files Browse the repository at this point in the history
The monkey-patching was placing the property under a name which differred from
that of the real function, with the latter being used to cache its returned
value.  Fixing the function name after cached property creation allows to use
the final, desired name to cache the value.
  • Loading branch information
ivilata committed Dec 13, 2023
1 parent df44d1a commit 62de9ec
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions b2h5py/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
def B2Dataset_opt_dataset_ok(self):
"""Is this dataset suitable for Blosc2 optimized slicing"""
return b2.opt_slicing_dataset_ok(self)
# Fixing observable function name as it is used to cache the result.
B2Dataset_opt_dataset_ok.func.__name__ = b2.opt_dataset_ok_prop


def B2Dataset___getitem__(self, args, new_dtype=None):
Expand Down

0 comments on commit 62de9ec

Please sign in to comment.