summaryrefslogtreecommitdiffstats
path: root/Lib/importlib
Commit message (Collapse)AuthorAgeFilesLines
* [3.10] gh-99130: Apply bugfixes from importlib_metadata 4.11.4. (#99132)Jason R. Coombs2022-11-102-5/+36
|
* gh-93353: Fix importlib.resources._tempfile() finalizer (GH-93377)Miss Islington (bot)2022-06-131-2/+5
| | | | | | | | Fix the importlib.resources.as_file() context manager to remove the temporary file if destroyed late during Python finalization: keep a local reference to the os.remove() function. Patch by Victor Stinner. (cherry picked from commit 443ca731d6b1267fe2f92985e0490460c95e44a8) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.10] bpo-47004: Sync with importlib_metadata 4.11.3. (GH-31854). (GH-31857)Jason R. Coombs2022-03-131-3/+30
| | | | | (cherry picked from commit b1e286860742e7ba6fadc75e3ddb6c2899a56919) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* bpo-46246: add missing __slots__ to importlib.metadata.DeprecatedList (GH-30452)Miss Islington (bot)2022-02-111-0/+2
| | | | | | | | | | Confirmed with @jaraco that this indeed needs a fix. A question that came up while I was digging into the code: I think `SelectableGroups` could similarly use `__slots__ = ()`, since its purpose seems only for convenience around `dict`, not to have attributes of its own. Automerge-Triggered-By: GH:jaraco (cherry picked from commit dd76b3f7d332dd6eced5cbc2ad2adfc397700b3d) Co-authored-by: Arie Bovenberg <a.c.bovenberg@gmail.com>
* [3.10] bpo-45703: Invalidate _NamespacePath cache on ↵Petr Viktorin2022-01-271-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | importlib.invalidate_cache (GH-29384) (GH-30922) Consider the following directory structure: . └── PATH1 └── namespace └── sub1 └── __init__.py And both PATH1 and PATH2 in sys path: $ PYTHONPATH=PATH1:PATH2 python3.11 >>> import namespace >>> import namespace.sub1 >>> namespace.__path__ _NamespacePath(['.../PATH1/namespace']) >>> ... While this interpreter still runs, PATH2/namespace/sub2 is created: . ├── PATH1 │ └── namespace │ └── sub1 │ └── __init__.py └── PATH2 └── namespace └── sub2 └── __init__.py The newly created module cannot be imported: >>> ... >>> namespace.__path__ _NamespacePath(['.../PATH1/namespace']) >>> import namespace.sub2 Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'namespace.sub2' Calling importlib.invalidate_caches() now newly allows to import it: >>> import importlib >>> importlib.invalidate_caches() >>> namespace.__path__ _NamespacePath(['.../PATH1/namespace']) >>> import namespace.sub2 >>> namespace.__path__ _NamespacePath(['.../PATH1/namespace', '.../PATH2/namespace']) This was not previously possible.
* [3.10] bpo-46474: Avoid REDoS in EntryPoint.pattern (sync with ↵Jason R. Coombs2022-01-231-2/+2
| | | | | | | importlib_metadata 4.10.1) (GH-30803) (GH-30827) (cherry picked from commit 51c3e28c8a163e58dc753765e3cc51d5a717e70d) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* bpo-46105: Honor spec when generating requirement specs with urls and ↵Miss Islington (bot)2021-12-161-2/+11
| | | | | | | extras. (GH-30151) (cherry picked from commit 109d96602199a91e94eb14b8cb3720841f22ded7) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* [bpo-45765] Fix distribution discovery on empty path. (GH-29487) (GH-29510)Miss Islington (bot)2021-11-131-1/+1
| | | | | | | (cherry picked from commit 6ec0dec7b7b50d4fee5b2b66cf38e4291bcdf44c) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com> Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* [3.10] bpo-45419: Fix interfaces on DegenerateFiles.Path (GH-28844)Jason R. Coombs2021-10-101-1/+2
|
* bpo-42135 Correct version slated for importlib.find_loader removal ↵Miss Islington (bot)2021-09-131-1/+1
| | | | | | | | | | (GH-28312) (GH-28321) importlib.find_loader should also be slated for 3.12 like the others in GH-25169 and as documented in https://docs.python.org/3.11/whatsnew/3.10.htmlGH-deprecated. (cherry picked from commit 9f93018b69d72cb48d3444554261ae3b0ea00c93) Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
* bpo-44464: Remove special exclusion for flake8 in the deprecation warnings. ↵Miss Islington (bot)2021-06-271-9/+1
| | | | | | | | | | (GH-26807) (GH-26929) Sync with importlib_metadata 4.6. (cherry picked from commit efe7d08d178a7c09bcca994f2068b019c8633d83) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com> Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* [3.10] bpo-44246: Restore compatibility in entry_points (GH-26468) (GH-26471)Miss Islington (bot)2021-05-311-1/+102
| | | | | | | | | | | | | * [bpo-44246](): Entry points performance improvements. From importlib_metadata 4.3.1. * [bpo-44246](): Sync with importlib_metadata 4.4 (cherry picked from commit c34ed08d975fb7daa7b329f7c631647782290393) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com> Automerge-Triggered-By: GH:jaraco
* bpo-44246: Entry points performance improvements. (GH-26467)Miss Islington (bot)2021-05-311-1/+23
| | | | | | From importlib_metadata 4.3.1. (cherry picked from commit 410b70d39d9d77384f8b8597560f6731530149ca) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* [3.10] bpo-44241: Incorporate changes from importlib_metadata 4.1. ↵Miss Islington (bot)2021-05-273-8/+28
| | | | | | | | | | (GH-26382) (GH-26395) (cherry picked from commit 06ac3a4742228b0230981720060248a7425b2486) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com> Automerge-Triggered-By: GH:jaraco
* bpo-38693: Prefer f-strings in importlib.resources (importlib_resources ↵Miss Islington (bot)2021-05-263-9/+6
| | | | | | | | | | 5.0.6). (GH-26387) (#26389) Automerge-Triggered-By: GH:jaraco (cherry picked from commit f6fbdb90ee450ad693f7a7809035d0dc968f98b7) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com> Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* bpo-38693: importlib.metadata f-strings (GH-26383)Miss Islington (bot)2021-05-261-5/+4
| | | | | | Automerge-Triggered-By: GH:jaraco (cherry picked from commit e6c815d2e34be5fdf6dbe773f0781691746d2289) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* bpo-44210: make importlib.metadata._meta.PackageMetadata public (GH-26299)Miss Islington (bot)2021-05-231-0/+2
| | | | | | | | Signed-off-by: Filipe Laíns <lains@riseup.net> Automerge-Triggered-By: GH:jaraco (cherry picked from commit df7eeacd83f531dd67cec7bc483dec6dce17ddbd) Co-authored-by: Filipe Laíns <lains@riseup.net>
* [3.10] bpo-43643: Sync with python/importlib_resources@c17a610aad. ↵Miss Islington (bot)2021-05-212-1/+3
| | | | | | | | | | | | (GH-26284) (GH-26286) * [bpo-43643](): Sync with python/importlib_resources@c17a610aad. * Sync with python/importlib_resources@89fd5e961a. (cherry picked from commit 875b3d84b3072b2d3c352ad9f0ff52c441fbd12e) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com> Automerge-Triggered-By: GH:jaraco
* bpo-43926: Cleaner metadata with PEP 566 JSON support. (GH-25565)Jason R. Coombs2021-05-027-23/+200
| | | | | | | | | * bpo-43926: Cleaner metadata with PEP 566 JSON support. * Add blurb * Add versionchanged and versionadded declarations for changes to metadata. * Use descriptor for PEP 566
* bpo-43754: Eliminate bindings for partial pattern matches (GH-25229)Brandt Bucher2021-05-021-1/+2
|
* bpo-42739: Don't use sentinels to mark end of line table. (GH-25657)Mark Shannon2021-04-291-1/+2
| | | | | * Add length parameter to PyLineTable_InitAddressRange and doen't use sentinel values at end of table. Makes the line number table more robust. * Update PyCodeAddressRange to match PEP 626.
* bpo-43780: Sync with importlib_metadata 3.10 (GH-25297)Jason R. Coombs2021-04-243-75/+258
| | | | | | | * bpo-43780: Sync with importlib_metadata 3.10. * Add blurb * Apply changes from importlib_metadata 3.10.1.
* bpo-38605: Revert making 'from __future__ import annotations' the default ↵Pablo Galindo2021-04-211-1/+2
| | | | | | (GH-25490) This reverts commits 044a1048ca93d466965afc027b91a5a9eb9ce23c and 1be456ae9d53bb1cba2b24fc86175c282d1c2169, adapting the code to changes that happened after it.
* Correct micro release number and add a couple of asserts. (GH-25224)Mark Shannon2021-04-071-1/+1
|
* bpo-43105: Importlib now resolves relative paths when creating module spec ↵Steve Dower2021-04-071-19/+62
| | | | objects from file locations (GH-25121)
* bump the bytecode magic number (GH-25225)Dennis Sweeney2021-04-061-1/+1
|
* bpo-42135: Deprecate implementations of find_module() and find_loader() ↵Brett Cannon2021-04-064-7/+37
| | | | (GH-25169)
* bpo-43683: Handle generator entry in bytecode (GH-25138)Mark Shannon2021-04-061-0/+1
| | | | | | * Handle check for sending None to starting generator and coroutine into bytecode. * Document new bytecode and make it fail gracefully if mis-compiled.
* bpo-27129: Update magic numbers and bootstrapping for GH-25069 (GH-25172)Dennis Sweeney2021-04-041-1/+1
| | | | | | | * Update magic numbers and bootstrapping for GH-25069 * add blurb Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* bpo-43720: Update import-related stdlib deprecation messages to say they ↵Brett Cannon2021-04-031-3/+6
| | | | will be removed in Python 3.12 (GH-25167)
* bpo-43672: raise ImportWarning when calling find_loader() (GH-25119)Brett Cannon2021-04-021-1/+4
|
* bpo-27129: Use instruction offsets, not byte offsets, in bytecode and ↵Mark Shannon2021-04-011-0/+1
| | | | | | | internally. (GH-25069) * Use instruction offset, rather than bytecode offset. Streamlines interpreter dispatch a bit, and removes most EXTENDED_ARGs for jumps. * Change some uses of PyCode_Addr2Line to PyFrame_GetLineNumber
* bpo-42134: Raise ImportWarning when calling find_module() in the import ↵Brett Cannon2021-03-302-2/+6
| | | | system (GH-25044)
* bpo-42136: Deprecate module_repr() as found in importlib (GH-25022)Brett Cannon2021-03-263-2/+9
|
* bpo-42137: have ModuleType.__repr__ prefer __spec__ over module_repr() ↵Brett Cannon2021-03-241-14/+6
| | | | | (GH-24953) This is to work towards the removal of the use of module_repr() in Python 3.12 (documented as deprecated since 3.4).
* bpo-43428: Improve documentation for importlib.metadata changes. (GH-24858)Jason R. Coombs2021-03-151-2/+18
| | | | | | | * bpo-43428: Sync with importlib_metadata 3.7.3 (16ac3a95) * Add 'versionadded' for importlib.metadata.packages_distributions * Add section in what's new for Python 3.10 highlighting most salient changes and relevant backport.
* bpo-43428: Sync with importlib_metadata 3.7. (GH-24782)Jason R. Coombs2021-03-132-25/+220
| | | | | | | * bpo-43428: Sync with importlib_metadata 3.7.2 (67234b6) * Add blurb * Reformat blurb to create separate paragraphs for each change included.
* bpo-42129: Add support for resources in namespaces (GH-24670)Jason R. Coombs2021-03-046-88/+270
| | | | | * Unify behavior in ResourceReaderDefaultsTests and align with the behavior found in importlib_resources. * Equip NamespaceLoader with a NamespaceReader. * Apply changes from importlib_resources 5.0.4
* bpo-42128: Structural Pattern Matching (PEP 634) (GH-22917)Brandt Bucher2021-02-261-1/+2
| | | | | Co-authored-by: Guido van Rossum <guido@python.org> Co-authored-by: Talin <viridia@gmail.com> Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* bpo-42382: In importlib.metadata, `EntryPoint` objects now expose `dist` ↵Jason R. Coombs2020-12-311-66/+119
| | | | | | | | | | | | | | (#23758) * bpo-42382: In importlib.metadata, `EntryPoint` objects now expose a `.dist` object referencing the `Distribution` when constructed from a `Distribution`. Also, sync importlib_metadata 3.3: - Add support for package discovery under package normalization rules. - The object returned by `metadata()` now has a formally-defined protocol called `PackageMetadata` with declared support for the `.get_all()` method. * Add blurb * Remove latent footnote.
* bpo-42246: Make sure that `f_lasti`, and thus `f_lineno`, is set correctly ↵Mark Shannon2020-12-171-1/+2
| | | | | | | | | after raising or reraising an exception (GH-23803) * Ensure that f_lasti is set correctly after an exception is raised to conform to PEP 626. * Update importlib * Add NEWS.
* bpo-26131: Deprecate usage of load_module() (GH-23469)Brett Cannon2020-12-043-8/+23
| | | Raise an ImportWarning when the import system falls back on load_module(). As for implementations of load_module(), raise a DeprecationWarning.
* bpo-42202: Store func annotations as a tuple (GH-23316)Yurii Karabas2020-11-251-1/+2
| | | | | | | | | | | | | Reduce memory footprint and improve performance of loading modules having many func annotations. >>> sys.getsizeof({"a":"int","b":"int","return":"int"}) 232 >>> sys.getsizeof(("a","int","b","int","return","int")) 88 The tuple is converted into dict on the fly when `func.__annotations__` is accessed first. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Inada Naoki <songofacandy@gmail.com>
* bpo-42403: Use @staticmethod in importlib (GH-23395)Victor Stinner2020-11-202-16/+16
| | | | | | | | | | | | | Use @staticmethod on methods using @classmethod but don't use their cls parameter on the following classes: * BuiltinImporter * FrozenImporter * WindowsRegistryFinder * PathFinder Leave methods using @_requires_builtin or @_requires_frozen unchanged, since this decorator requires the wrapped method to have an extra parameter (cls or self).
* bpo-42403: Simplify importlib external bootstrap (GH-23397)Victor Stinner2020-11-193-65/+55
| | | | | | | Simplify the importlib external bootstrap code: importlib._bootstrap_external now uses regular imports to import builtin modules. When it is imported, the builtin __import__() function is already fully working and so can be used to import builtin modules like sys.
* bpo-42403: Fix pyflakes warnings in importlib (GH-23396)Victor Stinner2020-11-193-4/+0
| | | Remove unused imports and unused local variables.
* Bump magic number. (GH-23245)Mark Shannon2020-11-121-1/+2
|
* bpo-41490: ``path`` and ``contents`` to aggressively close handles (#22915)Jason R. Coombs2020-10-253-16/+32
| | | | | | | | | * bpo-41490: ``path`` method to aggressively close handles * Add blurb * In ZipReader.contents, eagerly evaluate the contents to release references to the zipfile. * Instead use _ensure_sequence to ensure any iterable from a reader is eagerly converted to a list if it's not already a sequence.
* bpo-42089: Sync with current cpython branch of importlib_metadata (GH-22775)Barry Warsaw2020-10-191-0/+9
| | | | | ~~The only differences are in the test files.~~ Automerge-Triggered-By: @jaraco
* bpo-38605: bump the magic number for 'annotations' future (#22630)Batuhan Taskaya2020-10-101-1/+2
|