Commit d520e59c authored by payno's avatar payno
Browse files

[io] reset previous value of `HDF5_USE_FILE_LOCKING`

parent f4e71e86
Pipeline #35161 passed with stages
in 11 minutes and 1 second
......@@ -67,6 +67,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)
if enable_file_locking:
os.environ["HDF5_USE_FILE_LOCKING"] = "TRUE"
else:
......@@ -95,6 +96,10 @@ class HDF5File(h5py.File):
else:
kwargs["libver"] = libver
super().__init__(filename, mode=mode, swmr=swmr, **kwargs)
if old_file_locking is None:
del os.environ["HDF5_USE_FILE_LOCKING"]
else:
os.environ["HDF5_USE_FILE_LOCKING"] = old_file_locking
@contextmanager
def _protect_init(self, filename):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment