diff options
-rw-r--r-- | Lib/zipfile.py | 4 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2022-03-19-19-56-04.bpo-42369.Ok828t.rst | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py index 41bf49a..385adc8 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -747,7 +747,9 @@ class _SharedFile: self._lock = lock self._writing = writing self.seekable = file.seekable - self.tell = file.tell + + def tell(self): + return self._pos def seek(self, offset, whence=0): with self._lock: diff --git a/Misc/NEWS.d/next/Library/2022-03-19-19-56-04.bpo-42369.Ok828t.rst b/Misc/NEWS.d/next/Library/2022-03-19-19-56-04.bpo-42369.Ok828t.rst new file mode 100644 index 0000000..86dc3a0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-03-19-19-56-04.bpo-42369.Ok828t.rst @@ -0,0 +1 @@ +Fix thread safety of :meth:`zipfile._SharedFile.tell` to avoid a "zipfile.BadZipFile: Bad CRC-32 for file" exception when reading a :class:`ZipFile` from multiple threads. |