Content-Length: 314515 | pFad | http://github.com/python/cpython/pull/14957/commits/6b90dfd37474ae85d567f0aafc2101ff086aa770

51 bpo-37538: Zipfile refactor by danifus · Pull Request #14957 · python/cpython · GitHub
Skip to content

bpo-37538: Zipfile refactor #14957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a0db1c9
Add descriptive global variables for general purpose bit flags
danifus Jul 10, 2019
6710baf
Add global variable for zip64 extra data header id
danifus Jul 10, 2019
3777389
Add flag properties to ZipInfo
danifus Jul 10, 2019
f435f08
Restructure how ZipExtFile gets created from ZipFile.open
danifus Jul 10, 2019
ca41137
Fix bug when seeking on encrypted zip files
danifus Jul 10, 2019
00c87ee
Refactor _ZipDecrypter with a BaseZipDecrypter class
danifus Jul 11, 2019
b8364a6
Move compressor and decompressor selection code into classes
danifus Jul 12, 2019
6b256c0
Add zipinfo_cls, zipextfile_cls and zipwritefile_cls to ZipFile
danifus Jul 12, 2019
af8864b
Fix typo datadescripter -> datadescriptor
danifus Jul 13, 2019
42c4be6
Add dosdate and dostime properties to ZipInfo
danifus Jul 13, 2019
801d966
Move encoding datadescriptor to ZipInfo
danifus Jul 13, 2019
46604e0
Refactor how ZipInfo encodes the local file header.
danifus Jul 13, 2019
7d28d8f
Move central directory encoding to ZipInfo
danifus Jul 14, 2019
c784d7f
Move struct packing of central directory record to a ZipInfo method
danifus Jul 14, 2019
f84e481
Refactor _decodeExtra to allow subclasses to support new extra fields
danifus Jul 14, 2019
1a07518
Change the way zipfile _decodeExtra loops through the extra bytes
danifus Jul 14, 2019
6de1a9a
Decouple updating and checking crc when reading a zipfile
danifus Jul 14, 2019
6b90dfd
Move writing zipfile local header to _ZipWriteFile
danifus Jul 14, 2019
4417cc5
Move writing local header to within _ZipWriteFile
danifus Jul 15, 2019
bfa8a7e
Add some comments to zipfile's LZMACompressor
danifus Jul 15, 2019
a211abe
Add comments to ZipFile._write_end_record describing structs
danifus Jul 17, 2019
3eff8be
Small performance fix to zipfile.CRCZipDecrypter
danifus Jul 22, 2019
7220ef9
Refactor ZipFile encoding approach
danifus Jul 22, 2019
0a718f7
Change ZipInfo encoding of local extra data
danifus Jul 22, 2019
cb826d6
Allow ZipFile _open_to_write() and _open_to_read() to take kwargs
danifus Jul 26, 2019
5a88b2d
Change ZipFile._open_to_write() to accept pwd argument.
danifus Jul 26, 2019
fa374ee
ZipFile remove special case path for ZIP_STORED
danifus Jul 26, 2019
5bb4c17
📜🤖 Added by blurb_it.
blurb-it[bot] Jul 26, 2019
366f79f
bpo-37538: Small clean up of zipfile refactor
danifus Jul 27, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move writing zipfile local header to _ZipWriteFile
  • Loading branch information
danifus committed Jul 26, 2019
commit 6b90dfd37474ae85d567f0aafc2101ff086aa770
6 changes: 3 additions & 3 deletions Lib/zipfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,7 @@ def __init__(self, zf, zinfo, zip64):
self._compress_size = 0
self._crc = 0

self.write_local_header()
@property
def _fileobj(self):
return self._zipfile.fp
Expand All @@ -1519,6 +1520,8 @@ def get_compressor(self, compress_type, compresslevel=None):
def writable(self):
return True

def write_local_header(self):
self.fp.write(zinfo.FileHeader(zip64))
def write(self, data):
if self.closed:
raise ValueError('I/O operation on closed file.')
Expand Down Expand Up @@ -1974,9 +1977,6 @@ def _open_to_write(self, zinfo, force_zip64=False):

self._writecheck(zinfo)
self._didModify = True

self.fp.write(zinfo.FileHeader(zip64))

self._writing = True
return self.zipwritefile_cls(self, zinfo, zip64)

Expand Down








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/python/cpython/pull/14957/commits/6b90dfd37474ae85d567f0aafc2101ff086aa770

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy