We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ae01b8c commit edee203Copy full SHA for edee203
Lib/zipfile/__init__.py
@@ -1442,10 +1442,6 @@ def repack(self, zfile):
1442
[recorded local file entry 1]
1443
...
1444
"""
1445
- with zfile._lock:
1446
- self._repack(zfile)
1447
-
1448
- def _repack(self, zfile):
1449
fp = zfile.fp
1450
1451
# get a sorted filelist by header offset, in case the dir order
@@ -2271,7 +2267,12 @@ def repack(self, **opts):
2271
2267
"Can't write to ZIP archive while an open writing handle exists"
2272
2268
)
2273
2269
2274
- _ZipRepacker(**opts).repack(self)
2270
+ with self._lock:
+ self._writing = True
+ try:
+ _ZipRepacker(**opts).repack(self)
+ finally:
2275
+ self._writing = False
2276
2277
@classmethod
2278
def _sanitize_windows_name(cls, arcname, pathsep):
0 commit comments