summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zipfile.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.8] gh-123270: Replaced SanitizedNames with a more surgical fix. ↡Jason R. Coombs2024-09-041-0/+77
| | | | | | | | | | | (GH-123354) (#123433) Applies changes from zipp 3.20.1 and jaraco/zippGH-124 (cherry picked from commit 2231286d78d328c2f575e0b05b16fe447d1656d6) (cherry picked from commit 17b77bb41409259bad1cd6c74761c18b6ab1e860) (cherry picked from commit 66d3383) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* [3.8] gh-109858: Protect zipfile from "quoted-overlap" zipbomb (GH-110016) ↡Serhiy Storchaka2024-01-171-0/+60
| | | | | | | (GH-113916) Raise BadZipFile when try to read an entry that overlaps with other entry or central directory. (cherry picked from commit 66363b9a7b9fe7c99eba3a185b74c5fdbf842eba)
* bpo-40105: ZipFile truncate in append mode with shorter comment (GH-19337)Miss Islington (bot)2020-09-281-0/+3
| | | | | (cherry picked from commit ff9147d93b868f0e13b9fe14e2a76c2879f6787b) Co-authored-by: Jan Mazur <16736821+mzr@users.noreply.github.com>
* bpo-41068: Fix read after write in zipfile for non-ASCII files names. (GH-21040)Miss Islington (bot)2020-06-221-0/+5
| | | | | (cherry picked from commit 36ff513f82e372ed3cea0bf7cbdf15a1ef6dab9e) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.8] bpo-39667: Sync zipp 3.0 (GH-18540) (GH-18701)Miss Islington (bot)2020-04-151-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | * bpo-39667: Sync zipp 3.0 (GH-18540) * bpo-39667: Improve pathlib.Path compatibility on zipfile.Path and correct performance degradation as found in zipp 3.0 * πŸ“œπŸ€– Added by blurb_it. * Update docs for new zipfile.Path.open * Rely on dict, faster than OrderedDict. * Syntax edits on docs Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> (cherry picked from commit 0aeab5c4381f0cc11479362af2533b3a391312ac) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com> * Clarify the change in behavior with a couple of workaround options. * Restore API compatibility while backporting performance improvements. Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* bpo-39595: Improve zipfile.Path performance (GH-18406) (GH-18472)Miss Islington (bot)2020-02-121-39/+103
| | | | | | | | | | | | | | | | | | | | | | | * Improve zipfile.Path performance on zipfiles with a large number of entries. * πŸ“œπŸ€– Added by blurb_it. * Add bpo to blurb * Sync with importlib_metadata 1.5 (6fe70ca) * Update blurb. * Remove compatibility code * Add stubs module, omitted from earlier commit Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> (cherry picked from commit e5bd73632e77dc5ab0cab77e48e94ca5e354be8a) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com> Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* bpo-39502: Skip test_zipfile.test_add_file_after_2107() on AIX (GH-18282)Miss Islington (bot)2020-01-301-1/+6
| | | | | | | Skip test_zipfile.test_add_file_after_2107() if time.localtime() fails with OverflowError. It is the case on AIX 6.1 for example. (cherry picked from commit c232c9110cfefa0935cbf158e35e91746a8a9361) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-39460: Fix test_zipfile.test_add_file_after_2107() (GH-18247)Miss Islington (bot)2020-01-291-0/+12
| | | | | | | | | | | XFS filesystem is limited to 32-bit timestamp, but the utimensat() syscall doesn't fail. Moreover, there is a VFS bug which returns a cached timestamp which is different than the value on disk. https://bugzilla.redhat.com/show_bug.cgi?id=1795576 https://bugs.python.org/issue39460GH-msg360952 (cherry picked from commit 3cb49b62e61208efcefbc04414e769fc173f205d) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-36993: Improve error reporting for zipfiles with bad zip64 extra data. ↡Miss Skeleton (bot)2019-10-291-0/+222
| | | | | | | (GH-14656) (cherry picked from commit da6ce58dd5ac109485af45878fca6bfd265b43e9) Co-authored-by: Daniel Hillier <daniel.hillier@gmail.com>
* bpo-38334: Fix seeking backward on an encrypted zipfile.ZipExtFile. (GH-16937)Miss Skeleton (bot)2019-10-271-0/+38
| | | | | | Test by Daniel Hillier. (cherry picked from commit 5c32af7522d908e8c7da0243af37618433289cc5) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-36991: Fix incorrect exception escaping ZipFile.extract() (GH-13632)Miss Islington (bot)2019-09-121-0/+11
| | | | | (cherry picked from commit 2f1b857562b0f1601c9019db74c29b7d7e21ac9f) Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
* bpo-28494: Test existing zipfile working behavior. (GH-15853)Miss Islington (bot)2019-09-101-0/+40
| | | | | | Add unittests for executables with a zipfile appended to test_zipfile, as zipfile.is_zipfile and zipfile.ZipFile work properly on these today. (cherry picked from commit 3f4db4a0bab073b768fae958e93288bd5d24eadd) Co-authored-by: Gregory P. Smith <greg@krypto.org>
* bpo-37772: fix zipfile.Path.iterdir() outputs (GH-15170) (#15461)Miss Islington (bot)2019-08-241-46/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fix Path._add_implied_dirs to include all implied directories * fix Path._add_implied_dirs to include all implied directories * Optimize code by using sets instead of lists * πŸ“œπŸ€– Added by blurb_it. * fix Path._add_implied_dirs to include all implied directories * Optimize code by using sets instead of lists * πŸ“œπŸ€– Added by blurb_it. * Add tests to zipfile.Path.iterdir() fix * Update test for zipfile.Path.iterdir() * remove whitespace from test file * Rewrite NEWS blurb to describe the user-facing impact and avoid implementation details. * remove redundant [] within set comprehension * Update to use unique_everseen to maintain order and other suggestions in review * remove whitespace and add back add_dirs in tests * Add new standalone function parents using posixpath to get parents of a directory * removing whitespace (sorry) * Remove import pathlib from zipfile.py * Rewrite _parents as a slice on a generator of the ancestry of a path. * Remove check for '.' and '/', now that parents no longer returns those. * Separate calculation of implied dirs from adding those * Re-use _implied_dirs in tests for generating zipfile with dir entries. * Replace three fixtures (abcde, abcdef, abde) with one representative example alpharep. * Simplify implementation of _implied_dirs by collapsing the generation of parent directories for each name. (cherry picked from commit a4e2991bdc993b60b6457c8a38d6e4a1fc845781) Co-authored-by: shireenrao <shireenrao@gmail.com>
* bpo-37520: Correct behavior for zipfile.Path.parent (GH-14638) (GH-14641)Miss Islington (bot)2019-07-071-0/+11
| | | | | | | | * bpo-37520: Correct behavior for zipfile.Path.parent * πŸ“œπŸ€– Added by blurb_it. (cherry picked from commit 38f44b4a4adc37e8f5f8971917d8b3145f351a56) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* Remove unused imports in tests (GH-14518) (GH-14520)Victor Stinner2019-07-011-2/+0
| | | (cherry picked from commit 8f4ef3b019ce380022018587571b0f970e668de3)
* Add support for .parent and .joinpath in zipfile.Path (#13213)Jason R. Coombs2019-05-091-0/+14
|
* bpo-36832: add zipfile.Path (#13153)Jason R. Coombs2019-05-081-3/+113
| | | | | | | | | | | | | | | | | | | | | | | | * bpo-36832: add zipfile.Path * bpo-36832: add documentation for zipfile.Path * πŸ“œπŸ€– Added by blurb_it. * Remove module reference from blurb. * Sort the imports * Update docstrings and docs per recommendations. * Rely on test.support.temp_dir * Signal that 'root' is the parameter. * Correct spelling of 'mod' * Convert docstring to comment for brevity. * Fix more errors in the docs
* bpo-36434: Properly handle writing errors in ZIP files. (GH-12559)Serhiy Storchaka2019-03-301-0/+37
| | | | | Errors during writing no longer prevent to properly close the ZIP file.
* bpo-34341: Fix appending to ZIP archives with the ZIP64 extension. (GH-8683)Serhiy Storchaka2018-09-171-0/+14
|
* bpo-34097: Polish API design (GH-8725)Marcel Plch2018-08-311-4/+4
| | | Move strict_timestamps to constructor.
* bpo-34325: Skip zipfile test for large timestamps when filesystem don't ↡Marcel Plch2018-08-031-1/+5
| | | | | | support them. (GH-8656) When the filesystem doesn't support files with large timestamps, skip testing that such files can be zipped.
* bpo-34097: Add support for zipping files older than 1980-01-01 (GH-8270)Marcel Plch2018-08-021-0/+16
| | | | | ZipFile can zip files older than 1980-01-01 and newer than 2107-12-31 using a new strict_timestamps parameter at the cost of setting the timestamp to the limit.
* bpo-34035: Fix several AttributeError in zipfile seek() methods. (GH-8527)MickaΓ«l Schoentgen2018-07-291-0/+4
|
* bpo-22908: Add seek and tell functionality to ZipExtFile (GH-4966)John Jolly2018-01-301-0/+34
| | | | | This allows for nested zip files, tar files within zip files, zip files within tar files, etc. Contributed by: John Jolly
* bpo-21417: Add compresslevel= to the zipfile module (GH-5385)Bo Bayles2018-01-301-4/+36
| | | | | | This allows the compression level to be specified when writing zipfiles (for the entire file *and* overridden on a per-file basis). Contributed by Bo Bayles
* Fix miscellaneous typos (#4275)luzpaz2017-11-051-1/+1
|
* bpo-30017: Allowed calling the close() method of the zip entry writer object ↡Serhiy Storchaka2017-04-121-0/+42
| | | | | | (#1041) multiple times. Writing to closed zip entry writer object now always produce a ValueError.
* bpo-29958: Minor improvements to zipfile and tarfile CLI. (#944)Serhiy Storchaka2017-04-071-0/+10
|
* bpo-29919: Remove unused imports found by pyflakes (#137)Victor Stinner2017-03-271-1/+1
| | | Make also minor PEP8 coding style fixes on modified imports.
* bpo-28231: The zipfile module now accepts path-like objects for external ↡Serhiy Storchaka2017-03-081-15/+102
| | | | paths. (#511)
* Issue #28115: ZIP creation test requires zlib.Serhiy Storchaka2016-10-231-0/+1
|\
| * Issue #28115: ZIP creation test requires zlib.Serhiy Storchaka2016-10-231-0/+1
| |\
| | * Issue #28115: ZIP creation test requires zlib.Serhiy Storchaka2016-10-231-0/+1
| | |
* | | Issue #28115: Command-line interface of the zipfile module now uses argparse.Serhiy Storchaka2016-10-231-27/+31
|/ / | | | | | | Added support of long options.
* | Issue #28115: Added tests for CLI of the zipfile module.Serhiy Storchaka2016-10-231-1/+67
|\ \ | |/
| * Issue #28115: Added tests for CLI of the zipfile module.Serhiy Storchaka2016-10-231-1/+67
| |
* | Issue #26293: Fixed writing ZIP files that starts not from the start of theSerhiy Storchaka2016-10-071-0/+43
|\ \ | |/ | | | | | | file. Offsets in ZIP file now are relative to the start of the archive in conforming to the specification.
| * Issue #26293: Fixed writing ZIP files that starts not from the start of theSerhiy Storchaka2016-10-071-0/+43
| | | | | | | | | | file. Offsets in ZIP file now are relative to the start of the archive in conforming to the specification.
* | Issue #24693: Changed some RuntimeError's in the zipfile module to moreSerhiy Storchaka2016-09-101-20/+20
| | | | | | | | appropriate types. Improved some error messages and debugging output.
* | Issue #27029: Removed deprecated support of universal newlines mode from ↡Serhiy Storchaka2016-06-111-163/+4
| | | | | | | | ZipFile.open().
* | Restored test_interleaved. After issue #8886 it was a duplicate ofSerhiy Storchaka2016-05-131-4/+5
|\ \ | |/ | | | | test_different_file.
| * Restored test_interleaved. After issue #8886 it was a duplicate ofSerhiy Storchaka2016-05-131-4/+5
| | | | | | | | test_different_file.
* | Issue #26039: zipfile.ZipFile.open() can now be used to write data into a ZIPSerhiy Storchaka2016-05-131-6/+77
| | | | | | | | file, as well as for extracting data. Patch by Thomas Kluyver.
* | Issue #23277: Remove unused sys and os importsBerker Peksag2016-04-241-1/+0
| | | | | | | | Patch by Jon Dufresne.
* | Issue #26039: Added zipfile.ZipInfo.from_file() and zipinfo.ZipInfo.is_dir().Serhiy Storchaka2016-02-071-0/+15
|/ | | | Patch by Thomas Kluyver.
* Issue #25101: Try to create a file to test write access in test_zipfile.Serhiy Storchaka2015-09-191-0/+7
|\
| * Issue #25101: Try to create a file to test write access in test_zipfile.Serhiy Storchaka2015-09-191-0/+7
| |
* | Merge from 3.4.Larry Hastings2015-05-081-2/+3
|\ \ | |/
| * Issue #21520: test_zipfile no longer fails if the word 'bad' appearsLarry Hastings2015-05-081-2/+3
| | | | | | | | anywhere in the name of the current directory.
* | Issue #23731: Implement PEP 488.Brett Cannon2015-04-131-7/+4
| | | | | | | | | | | | The concept of .pyo files no longer exists. Now .pyc files have an optional `opt-` tag which specifies if any extra optimizations beyond the peepholer were applied.