Repository navigation
gh-73199: Fix incorrect zip64 threshold in doc #152472
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,7 +15,7 @@ defined in `PKZIP Application Note`_. | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| This module does not handle multipart ZIP files. | ||||||||||||||||||||||||
| It can handle ZIP files that use the ZIP64 extensions | ||||||||||||||||||||||||
| (that is ZIP files that are more than 4 GiB in size). It supports | ||||||||||||||||||||||||
| (mostly for ZIP files larger than 4 GiB). It supports | ||||||||||||||||||||||||
| decryption of encrypted files in ZIP archives, but it cannot | ||||||||||||||||||||||||
| create an encrypted file. Decryption is extremely slow as it is | ||||||||||||||||||||||||
| implemented in native Python rather than C. | ||||||||||||||||||||||||
|
|
@@ -204,10 +204,12 @@ ZipFile objects | |||||||||||||||||||||||
| (:mod:`zlib`, :mod:`bz2`, :mod:`lzma`, or :mod:`compression.zstd`) is not | ||||||||||||||||||||||||
| available, :exc:`RuntimeError` is raised. The default is :const:`ZIP_STORED`. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| If *allowZip64* is ``True`` (the default) zipfile will create ZIP files that | ||||||||||||||||||||||||
| use the ZIP64 extensions when the zipfile is larger than 4 GiB. If it is | ||||||||||||||||||||||||
| ``false`` :mod:`!zipfile` will raise an exception when the ZIP file would | ||||||||||||||||||||||||
| require ZIP64 extensions. | ||||||||||||||||||||||||
| If *allowZip64* is ``True`` (the default), ZIP64 extensions will be used | ||||||||||||||||||||||||
| on demand when the archive is written, such as when the total archive or an | ||||||||||||||||||||||||
| individual member is larger than 2 GiB (for compatibility with legacy tools | ||||||||||||||||||||||||
| even though the official hard limit is 4 GiB), or when there are more than | ||||||||||||||||||||||||
| 65535 members in the archive. If it is ``False``, an exception will be | ||||||||||||||||||||||||
| raised instead. | ||||||||||||||||||||||||
|
Comment on lines
+207
to
+212
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I suggest a few little changes, dropping unnecessary details, clarifying the exception, and noting what happens with
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would argue that "2 GiB threshold is for compatibility rather than official hard limit" is NOT an unnecessary detail. The developer may be confused and the current threshold may be suspected to be incorrectly assigned if this is not explicitly documented. The details about |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| The *compresslevel* parameter controls the compression level to use when | ||||||||||||||||||||||||
| writing files to the archive. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be 2 GiB, no? I suggest we drop it (as discussed in the issue).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is 4 GiB.
As discussed in the issue, the official hard limit for a local file for Zip64 is 4 GiB. I use "mostly" rather than "that is" because there are still other less common cases, such as > 65535 members, but it would be too verbose to mention all of them here.