summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zipimport.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.10] bpo-34990: Treat the pyc header's mtime in compileall as an unsigned ↵Miss Islington (bot)2021-08-241-7/+10
| | | | | | | | int (GH-19708) (cherry picked from commit bb21e28fd08f894ceff2405544a2f257d42b1354) Co-authored-by: Ammar Askar <ammar@ammaraskar.com> Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
* bpo-14678: Update zipimport to support importlib.invalidate_caches() (GH-24159)Desmond Cheong2021-03-081-0/+41
| | | Added an invalidate_caches() method to the zipimport.zipimporter class based on the implementation of importlib.FileFinder.invalidate_caches(). This was done by adding a get_files() method and an _archive_mtime attribute to zipimport.zipimporter to check for updates or cache invalidation whenever the cache of files and toc entry information in the zipimporter is accessed.
* bpo-24792: Fix zipimporter masking the cause of import errors (GH-22204)Irit Katriel2020-12-191-4/+4
| | | | | zipimport's _unmarshal_code swallows import errors and then _get_module_code doesn't know the cause of the error, and returns the generic, and sometimes incorrect, 'could not find...'. Automerge-Triggered-By: GH:brettcannon
* bpo-26131: Deprecate usage of load_module() (GH-23469)Brett Cannon2020-12-041-20/+31
| | | Raise an ImportWarning when the import system falls back on load_module(). As for implementations of load_module(), raise a DeprecationWarning.
* bpo-42131: Add PEP 451-related methods to zipimport (GH-23187)Brett Cannon2020-11-131-18/+53
| | | | | Specifically, find_spec(), create_module(), and exec_module(). Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
* bpo-40275: Use new test.support helper submodules in tests (GH-21412)Hai Shi2020-07-091-19/+21
|
* bpo-40275: More lazy imports in test.support (GH-20131)Hai Shi2020-05-181-1/+1
| | | | | | | | | | | | | | | | | | | Make the the following imports lazy in test.support: * bz2 * gzip * lzma * resource * zlib The following test.support decorators now need to be called with parenthesis: * @support.requires_bz2 * @support.requires_gzip * @support.requires_lzma * @support.requires_zlib For example, "@requires_zlib" becomes "@requires_zlib()".
* bpo-39033: Fix NameError in zipimport during hash validation (GH-17588)Xtreak2019-12-151-0/+16
| | | | Patch by Karthikeyan Singaravelan.
* bpo-22831: Use "with" to avoid possible fd leaks in tests (part 2). (GH-10929)Serhiy Storchaka2019-03-051-106/+92
|
* bpo-5950: Support reading zips with comments in zipimport (#9548)Zackery Spytz2018-09-251-0/+15
| | | * bpo-5950: Support reading zips with comments in zipimport
* bpo-25711: Remove outdated zipimport tests. (GH-9404)Serhiy Storchaka2018-09-191-49/+0
| | | They were specific to the C implementation.
* bpo-25711: Rewrite zipimport in pure Python. (GH-6809)Serhiy Storchaka2018-09-181-12/+17
|
* closes bpo-31650: PEP 552 (Deterministic pycs) implementation (#4575)Benjamin Peterson2017-12-091-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | Python now supports checking bytecode cache up-to-dateness with a hash of the source contents rather than volatile source metadata. See the PEP for details. While a fairly straightforward idea, quite a lot of code had to be modified due to the pervasiveness of pyc implementation details in the codebase. Changes in this commit include: - The core changes to importlib to understand how to read, validate, and regenerate hash-based pycs. - Support for generating hash-based pycs in py_compile and compileall. - Modifications to our siphash implementation to support passing a custom key. We then expose it to importlib through _imp. - Updates to all places in the interpreter, standard library, and tests that manually generate or parse pyc files to grok the new format. - Support in the interpreter command line code for long options like --check-hash-based-pycs. - Tests and documentation for all of the above.
* bpo-31781: Prevent crashes when calling methods of an uninitialized ↵Oren Milman2017-10-201-0/+14
| | | | zipimport.zipimporter object (GH-3986)
* bpo-31602: Fix an assertion failure in zipimporter.get_source() in case of a ↵Oren Milman2017-09-291-0/+17
| | | | | | | bad zlib.decompress() (GH-3784) While a rare potential failure (it requires swapping out zlib.decompress() itself and forcing it to return a non-bytes object), this change prevents a potential C-level assertion failure and instead substitutes it with an exception. Thanks to Oren Milman for the patch.
* bpo-31291: Fixed an assertion failure in zipimport.zipimporter.get_data() ↵Oren Milman2017-08-291-0/+17
| | | | | (#3226) if pathname.replace('/', '\\') returns non-string.
* Issue #28131: Merge from 3.5Berker Peksag2016-09-141-0/+13
|\
| * Issue #28131: Fix a regression in zipimport's compile_source()Berker Peksag2016-09-141-0/+13
| | | | | | | | zipimport should use the same optimization level as the interpreter.
* | Issue #25758: Prevents zipimport from unnecessarily encoding a filename ↵Steve Dower2016-09-101-1/+1
|\ \ | |/ | | | | (patch by Eryk Sun)
| * Issue #25758: Prevents zipimport from unnecessarily encoding a filename ↵Steve Dower2016-09-101-1/+1
| | | | | | | | (patch by Eryk Sun)
* | Issue #26754: Undocumented support of general bytes-like objectsSerhiy Storchaka2016-08-061-2/+4
| | | | | | | | as path in compile() and similar functions is now deprecated.
* | Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded asSerhiy Storchaka2016-06-181-0/+15
|\ \ | |/ | | | | an iterable of integers. Now only strings and byte-like objects are accepted.
| * Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded asSerhiy Storchaka2016-06-181-0/+15
| | | | | | | | an iterable of integers. Now only strings and byte-like objects are accepted.
* | Merge for issue #17633Brett Cannon2016-01-151-32/+216
|\ \ | |/
| * Issue #17633: Improve support for namespace packages with zipimport.Brett Cannon2016-01-151-32/+216
| | | | | | | | | | | | | | | | | | Previously zipimport mistakenly limited namespace support to only the top-level of the zipfile when it should have supported an arbitrary depth. Thanks to Phil Connel for the bug report and initial patch and Mike Romberg for the final patch.
* | Issue #8585: improved tests for zipimporter2. Patch from Mark Lawrence.Robert Collins2015-07-221-1/+20
|/
* Issue #23731: Implement PEP 488.Brett Cannon2015-04-131-1/+1
| | | | | | 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.
* Issue #23696: Remove test on ZipImportError.__context__ because the context isVictor Stinner2015-03-201-1/+0
| | | | | | | | | None on Windows. When the file is not readable, the error occurs at open on UNIX. On Windows, the error only occurs at the first operation on the open file. It would require to many changes to set __context__ to an OSError for all file operations, for a little benefit (__context__ is almost never used).
* Issue #23696: Chain ZipImportError to the OSErrorVictor Stinner2015-03-201-1/+4
|
* merge backout for #20621Benjamin Peterson2014-02-161-85/+19
|\
| * backout 2807a5f011e4 for causing #20621Benjamin Peterson2014-02-161-85/+19
| |
* | Fixes issue #19081: When a zipimport .zip file in sys.path being imported fromGregory P. Smith2014-01-081-19/+85
|\ \ | |/ | | | | | | | | is modified during the lifetime of the Python process after zipimport has already cached the zip's table of contents we detect this and recover rather than read bad data from the .zip (causing odd import errors).
| * Fixes Issue #19081: When a zipimport .zip file in sys.path being imported fromGregory P. Smith2014-01-081-19/+85
| | | | | | | | | | | | is modified during the lifetime of the Python process after zipimport has already cached the zip's table of contents we detect this and recover rather than read bad data from the .zip (causing odd import errors).
* | Issue 19572: More silently skipped tests explicitly skipped.Zachary Ware2013-12-081-1/+1
|\ \ | |/
| * Issue 19572: More silently skipped tests explicitly skipped.Zachary Ware2013-12-081-1/+1
| |
* | Issue #17177: Stop using imp in a bunch of testsBrett Cannon2013-06-151-3/+4
| |
* | Move code from test_importhooks into test_zipimport.Brett Cannon2013-06-121-1/+25
| |
* | Issue #8745: Small speed up zipimport on Windows. Patch by Catalin Iacob.Serhiy Storchaka2013-02-161-0/+2
| |
* | Replace IOError with OSError (#16715)Andrew Svetlov2012-12-251-1/+1
|/
* #8942: add test for __path__ contents in zipimport testsR David Murray2012-03-131-0/+4
| | | | Patch by Tatiana Al-Chueyr.
* Issue #13645: pyc files now contain the size of the corresponding sourceAntoine Pitrou2012-01-131-5/+5
| | | | | code, to avoid timestamp collisions (especially on filesystems with a low timestamp resolution) when checking for freshness of the bytecode.
* Issue #12451: Add support.create_empty_file()Victor Stinner2011-06-301-1/+1
| | | | | | | We don't need to create a temporary buffered binary or text file object just to create an empty file. Replace also os.fdopen(handle).close() by os.close(handle).
* (Merge 3.2) Issue #12124: zipimport doesn't keep a reference toVictor Stinner2011-05-191-17/+0
|\ | | | | | | zlib.decompress() anymore to be able to unload the module.
| * (Merge 3.1) Issue #12124: zipimport doesn't keep a reference toVictor Stinner2011-05-191-17/+0
| |\ | | | | | | | | | zlib.decompress() anymore to be able to unload the module.
| | * Issue #12124: zipimport doesn't keep a reference to zlib.decompress() anymoreVictor Stinner2011-05-191-17/+0
| | | | | | | | | | | | to be able to unload the module.
| | * Merged revisions 86596 via svnmerge fromEzio Melotti2010-11-211-27/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r86596 | ezio.melotti | 2010-11-20 21:04:17 +0200 (Sat, 20 Nov 2010) | 1 line #9424: Replace deprecated assert* methods in the Python test suite. ........
| | * Merged revisions 73715 via svnmerge fromGeorg Brandl2009-08-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://svn.python.org/python/branches/py3k ........ r73715 | benjamin.peterson | 2009-07-01 01:06:06 +0200 (Mi, 01 Jul 2009) | 1 line convert old fail* assertions to assert* ........
* | | Refactor a few tests to use the new requires_zlib decorator.Ezio Melotti2011-05-191-7/+1
|/ /
* | #9424: Replace deprecated assert* methods in the Python test suite.Ezio Melotti2010-11-201-27/+27
| |
* | test_zipimport: fix test nameVictor Stinner2010-08-171-1/+1
| |