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
4611b05b
Commit
4611b05b
authored
Jan 28, 2010
by
Ezio Melotti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid to use zlib when the compress type is not ZIP_DEFLATED
parent
9ef7d4f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
Lib/zipfile.py
Lib/zipfile.py
+8
-6
No files found.
Lib/zipfile.py
View file @
4611b05b
...
...
@@ -471,7 +471,12 @@ class ZipExtFile(io.BufferedIOBase):
self
.
_fileobj
=
fileobj
self
.
_decrypter
=
decrypter
self
.
_decompressor
=
zlib
.
decompressobj
(
-
15
)
self
.
_compress_type
=
zipinfo
.
compress_type
self
.
_compress_size
=
zipinfo
.
compress_size
self
.
_compress_left
=
zipinfo
.
compress_size
if
self
.
_compress_type
==
ZIP_DEFLATED
:
self
.
_decompressor
=
zlib
.
decompressobj
(
-
15
)
self
.
_unconsumed
=
''
self
.
_readbuffer
=
''
...
...
@@ -480,10 +485,6 @@ class ZipExtFile(io.BufferedIOBase):
self
.
_universal
=
'U'
in
mode
self
.
newlines
=
None
self
.
_compress_type
=
zipinfo
.
compress_type
self
.
_compress_size
=
zipinfo
.
compress_size
self
.
_compress_left
=
zipinfo
.
compress_size
# Adjust read size for encrypted files since the first 12 bytes
# are for the encryption/password information.
if
self
.
_decrypter
is
not
None
:
...
...
@@ -599,7 +600,8 @@ class ZipExtFile(io.BufferedIOBase):
self
.
_unconsumed
+=
data
# Handle unconsumed data.
if
len
(
self
.
_unconsumed
)
>
0
and
n
>
len_readbuffer
:
if
(
len
(
self
.
_unconsumed
)
>
0
and
n
>
len_readbuffer
and
self
.
_compress_type
==
ZIP_DEFLATED
):
data
=
self
.
_decompressor
.
decompress
(
self
.
_unconsumed
,
max
(
n
-
len_readbuffer
,
self
.
MIN_READ_SIZE
)
...
...
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