summaryrefslogtreecommitdiffstats
path: root/Lib/zipimport.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-103200: Fix performance issues with `zipimport.invalidate_caches()` ↵Desmond Cheong2023-07-071-21/+25
| | | | | | (GH-103208) Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Brett Cannon <brett@python.org>
* GH-87235: Make sure "python /dev/fd/9 9</path/to/script.py" works on macOS ↵Ronald Oussoren2022-11-271-98/+105
| | | | | | | | | | | | (#99768) On macOS all file descriptors for a particular file in /dev/fd share the same file offset, that is ``open("/dev/fd/9", "r")`` behaves more like ``dup(9)`` than a regular open. This causes problems when a user tries to run "/dev/fd/9" as a script because zipimport changes the file offset to try to read a zipfile directory. Therefore change zipimport to reset the file offset after trying to read the zipfile directory.
* gh-91181: drop support for bytes on sys.path (GH-31934)Thomas Grainger2022-07-171-2/+1
| | | | | | Support for bytes broke sometime between Python 3.2 and 3.6 and has been broken ever since. Trying to bring back supports is surprisingly difficult in the face of -b and checking for keys in sys.path_importer_cache. Since the support was broken for so long, trying to overcome the difficulty of bringing back the support has been deemed not worth it. Co-authored-by: Eryk Sun <eryksun@gmail.com> Co-authored-by: Brett Cannon <brett@python.org>
* gh-94379: Remove zipimport find_loader() and find_module() methods (#94380)Victor Stinner2022-07-051-58/+0
| | | | | zipimport: Remove find_loader() and find_module() methods, deprecated in Python 3.10: use the find_spec() method instead. See PEP 451 for the rationale.
* bpo-45183: don't raise an exception when calling ↵Brett Cannon2021-09-171-1/+1
| | | | | zipimport.zipimporter.find_spec() when the zip file is missing and the internal cache has been reset (GH-28435) This can occur when the zip file gets deleted, you call zipimport.zipimporter.invalidate_cache(), and then try to use zipimport.zipimporter.find_spec() (i.e. you left the zip file path on sys.path).
* bpo-42135: Deprecate implementations of find_module() and find_loader() ↵Brett Cannon2021-04-061-0/+6
| | | | (GH-25169)
* bpo-14678: Update zipimport to support importlib.invalidate_caches() (GH-24159)Desmond Cheong2021-03-081-0/+10
| | | 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-18/+20
| | | | | 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-1/+5
| | | 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-1/+33
| | | | | Specifically, find_spec(), create_module(), and exec_module(). Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
* bpo-39791 native hooks for importlib.resources.files (GH-20576)Jason R. Coombs2020-06-081-76/+2
| | | | | | | | | | | | | | | | | | | | | | | | | * Provide native .files support on SourceFileLoader. * Add native importlib.resources.files() support to zipimporter. Remove fallback support. * make regen-all * 📜🤖 Added by blurb_it. * Move 'files' into the ResourceReader so it can carry the relevant module name context. * Create 'importlib.readers' module and add FileReader to it. * Add zip reader and rely on it for a TraversableResources object on zipimporter. * Remove TraversableAdapter, no longer needed. * Update blurb. * Replace backslashes with forward slashes. * Incorporate changes from importlib_metadata 2.0, finalizing the interface for extension via get_resource_reader. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* bpo-39033: Fix NameError in zipimport during hash validation (GH-17588)Xtreak2019-12-151-1/+1
| | | | Patch by Karthikeyan Singaravelan.
* bpo-36842: Implement PEP 578 (GH-12613)Steve Dower2019-05-231-2/+2
| | | Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
* bpo-34726: Fix handling of hash-based pycs in zipimport. (GH-10327)Elvis Pranskevichus2018-11-071-29/+66
| | | | | | | | Current support for hash-based bytecode files in `zipimport` is rather sparse, which leads to test failures when the test suite is ran with the ``SOURCE_DATE_EPOCH`` environment variable set. This teaches zipimport to handle hash-based pycs properly.
* bpo-5950: Support reading zips with comments in zipimport (#9548)Zackery Spytz2018-09-251-5/+31
| | | * bpo-5950: Support reading zips with comments in zipimport
* bpo-25711: Move _ZipImportResourceReader from importlib to zipimport. (GH-9406)Serhiy Storchaka2018-09-191-2/+81
|
* bpo-25711: Rewrite zipimport in pure Python. (GH-6809)Serhiy Storchaka2018-09-181-0/+650