summaryrefslogtreecommitdiffstats
path: root/Lib/zipfile
diff options
context:
space:
mode:
authorDima Ryazanov <dima@bucket.xxx>2024-12-24 15:56:42 (GMT)
committerGitHub <noreply@github.com>2024-12-24 15:56:42 (GMT)
commit7ed6c5c6961d0849f163d4d449fb36bae312b6bc (patch)
tree555479da4b66f1418174199ef03207189b7c968f /Lib/zipfile
parent9fce90682553e2cfe93e98e2ae5948bf9c7c4456 (diff)
downloadcpython-7ed6c5c6961d0849f163d4d449fb36bae312b6bc.zip
cpython-7ed6c5c6961d0849f163d4d449fb36bae312b6bc.tar.gz
cpython-7ed6c5c6961d0849f163d4d449fb36bae312b6bc.tar.bz2
gh-127847: Fix position in the special-cased zipfile seek (#127856)
--------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Diffstat (limited to 'Lib/zipfile')
-rw-r--r--Lib/zipfile/__init__.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/zipfile/__init__.py b/Lib/zipfile/__init__.py
index 6907ae6..f4d396a 100644
--- a/Lib/zipfile/__init__.py
+++ b/Lib/zipfile/__init__.py
@@ -819,7 +819,10 @@ class _SharedFile:
raise ValueError("Can't reposition in the ZIP file while "
"there is an open writing handle on it. "
"Close the writing handle before trying to read.")
- self._file.seek(offset, whence)
+ if whence == os.SEEK_CUR:
+ self._file.seek(self._pos + offset)
+ else:
+ self._file.seek(offset, whence)
self._pos = self._file.tell()
return self._pos