Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3f8c6913
Commit
3f8c6913
authored
Jul 29, 2018
by
Mickaël Schoentgen
Committed by
Serhiy Storchaka
Jul 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-34035: Fix several AttributeError in zipfile seek() methods. (GH-8527)
parent
d2e902e4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
4 deletions
+9
-4
Lib/test/test_zipfile.py
Lib/test/test_zipfile.py
+4
-0
Lib/zipfile.py
Lib/zipfile.py
+3
-4
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS.d/next/Library/2018-07-28-15-00-31.bpo-34035.75nW0H.rst
...S.d/next/Library/2018-07-28-15-00-31.bpo-34035.75nW0H.rst
+1
-0
No files found.
Lib/test/test_zipfile.py
View file @
3f8c6913
...
...
@@ -1646,6 +1646,8 @@ class OtherTests(unittest.TestCase):
self
.
assertEqual
(
fp
.
read
(
5
),
txt
[
bloc
:
bloc
+
5
])
fp
.
seek
(
0
,
os
.
SEEK_END
)
self
.
assertEqual
(
fp
.
tell
(),
len
(
txt
))
fp
.
seek
(
0
,
os
.
SEEK_SET
)
self
.
assertEqual
(
fp
.
tell
(),
0
)
# Check seek on memory file
data
=
io
.
BytesIO
()
with
zipfile
.
ZipFile
(
data
,
mode
=
"w"
)
as
zipf
:
...
...
@@ -1661,6 +1663,8 @@ class OtherTests(unittest.TestCase):
self
.
assertEqual
(
fp
.
read
(
5
),
txt
[
bloc
:
bloc
+
5
])
fp
.
seek
(
0
,
os
.
SEEK_END
)
self
.
assertEqual
(
fp
.
tell
(),
len
(
txt
))
fp
.
seek
(
0
,
os
.
SEEK_SET
)
self
.
assertEqual
(
fp
.
tell
(),
0
)
def
tearDown
(
self
):
unlink
(
TESTFN
)
...
...
Lib/zipfile.py
View file @
3f8c6913
...
...
@@ -701,11 +701,11 @@ class _SharedFile:
def
seek
(
self
,
offset
,
whence
=
0
):
with
self
.
_lock
:
if
self
.
writing
():
if
self
.
_
writing
():
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
(
self
.
_pos
)
self
.
_file
.
seek
(
offset
,
whence
)
self
.
_pos
=
self
.
_file
.
tell
()
return
self
.
_pos
...
...
@@ -1021,14 +1021,13 @@ class ZipExtFile(io.BufferedIOBase):
read_offset
=
0
elif
read_offset
<
0
:
# Position is before the current position. Reset the ZipExtFile
self
.
_fileobj
.
seek
(
self
.
_orig_compress_start
)
self
.
_running_crc
=
self
.
_orig_start_crc
self
.
_compress_left
=
self
.
_orig_compress_size
self
.
_left
=
self
.
_orig_file_size
self
.
_readbuffer
=
b''
self
.
_offset
=
0
self
.
_decompressor
=
zipfile
.
_get_decompressor
(
self
.
_compress_type
)
self
.
_decompressor
=
_get_decompressor
(
self
.
_compress_type
)
self
.
_eof
=
False
read_offset
=
new_pos
...
...
Misc/ACKS
View file @
3f8c6913
...
...
@@ -1435,6 +1435,7 @@ Michael Schneider
Peter Schneider-Kamp
Arvin Schnell
Nofar Schnider
Mickaël Schoentgen
Ed Schouten
Scott Schram
Robin Schreiber
...
...
Misc/NEWS.d/next/Library/2018-07-28-15-00-31.bpo-34035.75nW0H.rst
0 → 100644
View file @
3f8c6913
Fix several AttributeError in zipfile seek() methods. Patch by Mickaël Schoentgen.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment