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
2f1b8575
Commit
2f1b8575
authored
Sep 12, 2019
by
Berker Peksag
Committed by
Gregory P. Smith
Sep 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-36991: Fix incorrect exception escaping ZipFile.extract() (GH-13632)
parent
99b54d68
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
0 deletions
+14
-0
Lib/test/test_zipfile.py
Lib/test/test_zipfile.py
+11
-0
Lib/zipfile.py
Lib/zipfile.py
+1
-0
Misc/NEWS.d/next/Library/2019-09-12-14-52-38.bpo-36991.1OcSm8.rst
...S.d/next/Library/2019-09-12-14-52-38.bpo-36991.1OcSm8.rst
+2
-0
No files found.
Lib/test/test_zipfile.py
View file @
2f1b8575
...
@@ -9,6 +9,7 @@ import subprocess
...
@@ -9,6 +9,7 @@ import subprocess
import
sys
import
sys
import
time
import
time
import
unittest
import
unittest
import
unittest.mock
as
mock
import
zipfile
import
zipfile
...
@@ -1766,6 +1767,16 @@ class OtherTests(unittest.TestCase):
...
@@ -1766,6 +1767,16 @@ class OtherTests(unittest.TestCase):
fp
.
seek
(
0
,
os
.
SEEK_SET
)
fp
.
seek
(
0
,
os
.
SEEK_SET
)
self
.
assertEqual
(
fp
.
tell
(),
0
)
self
.
assertEqual
(
fp
.
tell
(),
0
)
@
requires_bz2
def
test_decompress_without_3rd_party_library
(
self
):
data
=
b'PK
\
x05
\
x06
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
\
x00
'
zip_file
=
io
.
BytesIO
(
data
)
with
zipfile
.
ZipFile
(
zip_file
,
'w'
,
compression
=
zipfile
.
ZIP_BZIP2
)
as
zf
:
zf
.
writestr
(
'a.txt'
,
b'a'
)
with
mock
.
patch
(
'zipfile.bz2'
,
None
):
with
zipfile
.
ZipFile
(
zip_file
)
as
zf
:
self
.
assertRaises
(
RuntimeError
,
zf
.
extract
,
'a.txt'
)
def
tearDown
(
self
):
def
tearDown
(
self
):
unlink
(
TESTFN
)
unlink
(
TESTFN
)
unlink
(
TESTFN2
)
unlink
(
TESTFN2
)
...
...
Lib/zipfile.py
View file @
2f1b8575
...
@@ -703,6 +703,7 @@ def _get_compressor(compress_type, compresslevel=None):
...
@@ -703,6 +703,7 @@ def _get_compressor(compress_type, compresslevel=None):
def
_get_decompressor
(
compress_type
):
def
_get_decompressor
(
compress_type
):
_check_compression
(
compress_type
)
if
compress_type
==
ZIP_STORED
:
if
compress_type
==
ZIP_STORED
:
return
None
return
None
elif
compress_type
==
ZIP_DEFLATED
:
elif
compress_type
==
ZIP_DEFLATED
:
...
...
Misc/NEWS.d/next/Library/2019-09-12-14-52-38.bpo-36991.1OcSm8.rst
0 → 100644
View file @
2f1b8575
Fixes a potential incorrect AttributeError exception escaping
ZipFile.extract() in some unsupported input error situations.
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