Skip to content

Commit 877e385

Browse files
authored
lock: add a workaround for a flufl.lock bug (#2688)
This bug doesn't affect us during regular dvc CLI commands, but is not visualy pleasing during API usage. Fixes #2573
1 parent a48481b commit 877e385

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

dvc/lock.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,17 @@ def _set_claimfile(self, pid=None):
8787
self._tmp_dir, filename + ".lock"
8888
)
8989

90+
# Fix for __del__ bug in flufl.lock [1] which is causing errors on
91+
# Python shutdown [2].
92+
# [1] https://gitlab.com/warsaw/flufl.lock/issues/7
93+
# [2] https://github.com/iterative/dvc/issues/2573
94+
def __del__(self):
95+
try:
96+
if self._owned:
97+
self.finalize()
98+
except ImportError:
99+
pass
100+
90101

91102
else:
92103
import zc.lockfile

0 commit comments

Comments
 (0)