Skip to content
Snippets Groups Projects
Commit 785171d1 authored by Pierre Paleo's avatar Pierre Paleo
Browse files

Rename "old_file_locking" into "existing_file_locking"

parent 2ffe7455
No related branches found
No related tags found
1 merge request!61[io][HDF5File] benefit when possible of the "locking" parameter from h5py
Pipeline #59174 failed
......@@ -72,7 +72,7 @@ class HDF5File(h5py.File):
kwargs["libver"] = "latest"
if enable_file_locking is None:
enable_file_locking = mode != "r"
old_file_locking = os.environ.get("HDF5_USE_FILE_LOCKING", None)
existing_file_locking = os.environ.get("HDF5_USE_FILE_LOCKING", None)
def use_h5py_API_for_file_locking():
"""use h5py API if (for HDF5 >= 1.12.1 or 1.10.x >= 1.10.7)"""
......@@ -134,10 +134,10 @@ class HDF5File(h5py.File):
kwargs["libver"] = libver
super().__init__(filename, mode=mode, swmr=swmr, **kwargs)
if not use_h5py_API_for_file_locking():
if old_file_locking is None:
if existing_file_locking is None:
del os.environ["HDF5_USE_FILE_LOCKING"]
else:
os.environ["HDF5_USE_FILE_LOCKING"] = old_file_locking
os.environ["HDF5_USE_FILE_LOCKING"] = existing_file_locking
@contextmanager
def _protect_init(self, filename):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment