summaryrefslogtreecommitdiffstats
path: root/Lib/importlib
Commit message (Collapse)AuthorAgeFilesLines
* [3.9] bpo-47004: Sync with importlib_metadata 4.11.3. (GH-31854). (GH-31859)Jason R. Coombs2022-03-131-2/+11
| | | | | (cherry picked from commit b1e286860742e7ba6fadc75e3ddb6c2899a56919) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* [3.9] bpo-45703: Invalidate _NamespacePath cache on ↵Petr Viktorin2022-02-021-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | importlib.invalidate_cache (GH-29384) (GH-30922) (GH-31076) 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. Co-Authored-By: Miro Hrončok <miro@hroncok.cz> Automerge-Triggered-By: GH:encukou
* [3.9] bpo-46474: Avoid REDoS in EntryPoint.pattern (sync with ↵Jason R. Coombs2022-01-231-2/+2
| | | | | | | importlib_metadata 4.10.1) (GH-30803). (GH-30828) (cherry picked from commit 51c3e28c8a163e58dc753765e3cc51d5a717e70d) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* [3.9] bpo-46105: Honor spec when generating requirement specs with urls and ↵Jason R. Coombs2021-12-171-3/+12
| | | | | | | extras. (GH-30151). (GH-30157) (cherry picked from commit 109d96602199a91e94eb14b8cb3720841f22ded7) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* [3.9] [bpo-45765] Fix distribution discovery on empty path. (GH-29487). ↵Jason R. Coombs2021-11-131-1/+1
| | | | | | | (GH-29511) (cherry picked from commit 6ec0dec7b7b50d4fee5b2b66cf38e4291bcdf44c) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* bpo-44070: No longer eagerly makes import filenames absolute, except for ↵Steve Dower2021-05-101-5/+5
| | | | extension modules (GH-26025)
* bpo-43105: Importlib now resolves relative paths when creating module spec ↵Steve Dower2021-04-071-19/+89
| | | | objects from file locations (GH-25121)
* [3.9] bpo-40924: Remove protocol for supplying Traversable objects from ↵Jason R. Coombs2020-06-141-11/+1
| | | | | loaders (GH-20820) Remove protocol that loaders can present a files method as found in importlib_resources 1.3-1.6 (added in Python 3.8b1).
* [3.9] bpo-40924: Revert "bpo-39791 native hooks for ↵Łukasz Langa2020-06-095-110/+115
| | | | | | importlib.resources.files (GH-20576)" (#20760) This reverts commit 9cf1be46e3692d565461afd3afa326d124d743dd due to https://bugs.python.org/issue40924.
* bpo-39791 native hooks for importlib.resources.files (GH-20576)Miss Islington (bot)2020-06-085-115/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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> (cherry picked from commit 843c27765652e2322011fb3e5d88f4837de38c06) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* bpo-39791: Refresh importlib.metadata from importlib_metadata 1.6.1. ↵Miss Islington (bot)2020-06-051-5/+25
| | | | | | | | | | | | | | (GH-20659) (GH-20661) * Refresh importlib.metadata from importlib_metadata 1.6.1. * 📜🤖 Added by blurb_it. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> (cherry picked from commit 161541ab45278df6603dd870113b10f13e4d9e16) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com> Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* bpo-39791: Add files() to importlib.resources (GH-19722)Jason R. Coombs2020-05-083-102/+217
| | | | | | | | | * bpo-39791: Update importlib.resources to support files() API (importlib_resources 1.5). * 📜🤖 Added by blurb_it. * Add some documentation about the new objects added. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* bpo-40443: Remove unused imports in stdlib (GH-19815)Victor Stinner2020-05-011-2/+1
|
* bpo-40050: Fix importlib._bootstrap_external (GH-19135)Victor Stinner2020-03-241-21/+13
| | | | | | Remove two unused imports: _thread and _weakref. Avoid creating a new winreg builtin module if it's already available in sys.modules. The winreg module is now stored as "winreg" rather than "_winreg".
* bpo-38691: importlib ignores PYTHONCASEOK if -E is used (GH-18627)idomic2020-03-091-2/+2
| | | | | The importlib module now ignores the PYTHONCASEOK environment variable when the -E or -I command line options are being used.
* bpo-38091: Import deadlock detection causes deadlock (GH-17518)Armin Rigo2020-03-031-0/+9
| | | Automerge-Triggered-By: @brettcannon
* Revert "bpo-38691 Added a switch to ignore PYTHONCASEOK when -E or -I flags ↵Victor Stinner2020-02-191-1/+1
| | | | | passed (#18314)" (GH-18553) This reverts commit d83b6600b25487e4ebffd7949d0f478de9538875.
* bpo-38691 Added a switch to ignore PYTHONCASEOK when -E or -I flags passed ↵idomic2020-02-171-1/+1
| | | | | | | | | | | | | | | | | | | | | (#18314) * Hard reset + cherry piciking the changes. * 📜🤖 Added by blurb_it. * Added @vstinner News * Update Misc/NEWS.d/next/Library/2020-02-11-13-01-38.bpo-38691.oND8Sk.rst Co-Authored-By: Victor Stinner <vstinner@python.org> * Hard reset to master * Hard reset to master + latest changes Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-39595: Improve zipfile.Path performance (#18406)Jason R. Coombs2020-02-121-5/+7
| | | | | | | | | | | | | | | | | | * 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>
* bpo-39320: Handle unpacking of **values in compiler (GH-18141)Mark Shannon2020-01-271-1/+2
| | | | | | | | | | | | | * Add DICT_UPDATE and DICT_MERGE bytecodes. Use them for ** unpacking. * Remove BUILD_MAP_UNPACK and BUILD_MAP_UNPACK_WITH_CALL, as they are now unused. * Update magic number for ** unpacking opcodes. * Update dis.rst to incorporate new bytecodes. * Add blurb entry.
* bpo-39320: Handle unpacking of *values in compiler (GH-17984)Mark Shannon2020-01-231-1/+3
| | | | | | | | * Add three new bytecodes: LIST_TO_TUPLE, LIST_EXTEND, SET_UPDATE. Use them to implement star unpacking expressions. * Remove four bytecodes BUILD_LIST_UNPACK, BUILD_TUPLE_UNPACK, BUILD_SET_UNPACK and BUILD_TUPLE_UNPACK_WITH_CALL opcodes as they are now unused. * Update magic number and dis.rst for new bytecodes.
* bpo-39336: Allow packages to not let their child modules be set on them (#18006)Dino Viehland2020-01-231-1/+6
| | | | | * bpo-39336: Allow setattr to fail on modules which aren't assignable When attaching a child module to a package if the object in sys.modules raises an AttributeError (e.g. because it is immutable) it causes the whole import to fail. This now allows immutable packages to exist and an ImportWarning is reported and the AttributeError exception is ignored.
* bpo-39156: Break up COMPARE_OP into four logically distinct opcodes. (GH-17754)Mark Shannon2020-01-141-1/+2
| | | | | | | | Break up COMPARE_OP into four logically distinct opcodes: * COMPARE_OP for rich comparisons * IS_OP for 'is' and 'is not' tests * CONTAINS_OP for 'in' and 'is not' tests * JUMP_IF_NOT_EXC_MATCH for checking exceptions in 'try-except' statements.
* bpo-39297: Update for importlib_metadata 1.4. (GH-17947)Jason R. Coombs2020-01-111-36/+72
| | | | | | | | | | * bpo-39297: Update for importlib_metadata 1.4. Includes performance updates. * 📜🤖 Added by blurb_it. * Update blurb Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* bpo-39022, bpo-38594: Sync with importlib_metadata 1.3 (GH-17568)Jason R. Coombs2019-12-111-1/+22
| | | | | | | | * bpo-39022, bpo-38594: Sync with importlib_metadata 1.3 including improved docs for custom finders and better serialization support in EntryPoints. * 📜🤖 Added by blurb_it. * Correct module reference
* Produce cleaner bytecode for 'with' and 'async with' by generating separate ↵Mark Shannon2019-11-211-1/+3
| | | | | | code for normal and exceptional paths. (#6641) Remove BEGIN_FINALLY, END_FINALLY, CALL_FINALLY and POP_FINALLY bytecodes. Implement finally blocks by code duplication. Reimplement frame.lineno setter using line numbers rather than bytecode offsets.
* Remove binding of captured exceptions when not used to reduce the chances of ↵Pablo Galindo2019-11-191-1/+1
| | | | | | | creating cycles (GH-17246) Capturing exceptions into names can lead to reference cycles though the __traceback__ attribute of the exceptions in some obscure cases that have been reported previously and fixed individually. As these variables are not used anyway, we can remove the binding to reduce the chances of creating reference cycles. See for example GH-13135
* bpo-38121: Sync importlib.metadata with 0.22 backport (GH-15993)Jason R. Coombs2019-09-122-65/+78
| | | | | | * bpo-38121: Sync importlib.metadata with 0.22 backport * 📜🤖 Added by blurb_it.
* bpo-35923: Update the BuiltinImporter to use loader._ORIGIN instead of a ↵Dong-hee Na2019-09-111-2/+4
| | | | | | hard-coded value (GH-15651)
* bpo-38086: Sync importlib.metadata with importlib_metadata 0.21. (GH-15840)Jason R. Coombs2019-09-102-22/+59
| | | https://gitlab.com/python-devs/importlib_metadata/-/tags/0.21
* bpo-38010 Sync importlib.metadata with importlib_metadata 0.20. (GH-15646)Jason R. Coombs2019-09-021-3/+15
| | | Sync importlib.metadata with importlib_metadata 0.20.
* bpo-34880: Add the LOAD_ASSERTION_ERROR opcode. (GH-15073)Zackery Spytz2019-08-251-1/+2
| | | | Fix assert statement misbehavior if AssertionError is shadowed.
* bpo-37830: Fix compilation of break and continue in finally. (GH-15320)Serhiy Storchaka2019-08-241-1/+2
| | | | | | Fix compilation of "break" and "continue" in the "finally" block when the corresponding "try" block contains "return" with a non-constant value.
* bpo-37685: Fixed __eq__, __lt__ etc implementations in some classes. (GH-14952)Serhiy Storchaka2019-08-081-1/+1
| | | | They now return NotImplemented for unsupported type of the other operand.
* Make importlib.metadata a simple module (#15153)Barry Warsaw2019-08-061-0/+0
|
* bpo-37444: Update differing exception between builtins and importlib (GH-14869)Ngalim Siregar2019-08-032-3/+3
| | | | | | | | | | Imports now raise `TypeError` instead of `ValueError` for relative import failures. This makes things consistent between `builtins.__import__` and `importlib.__import__` as well as using a more natural import for the failure. https://bugs.python.org/issue37444 Automerge-Triggered-By: @brettcannon
* bpo-37697: Sync with importlib_metadata 0.19 (#14993)Jason R. Coombs2019-07-282-11/+20
| | | | | | | | * bpo-37697: Sync with importlib_metadata 0.19 * Run make regen-importlib * 📜🤖 Added by blurb_it.
* Fix typos in docs, comments and test assert messages (#14872)Min ho Kim2019-07-211-1/+1
|
* bpo-37593: Swap the positions of posonlyargs and args in the constructor of ↵Pablo Galindo2019-07-141-1/+3
| | | | | ast.parameters nodes (GH-14778) https://bugs.python.org/issue37593
* bpo-35224: Bump the pyc magic number by 1 instead of by 10 in last ↵Pablo Galindo2019-06-231-2/+2
| | | | modification (GH-14320)
* bpo-35224: Bump the pyc magic number after the change in MAP_ADD (GH-14313)Pablo Galindo2019-06-221-1/+3
|
* cross port importlib-metadata PR #76 (#13903)Anthony Sottile2019-06-071-0/+2
| | | https://gitlab.com/python-devs/importlib_metadata/merge_requests/76
* Don't crash if there exists an EGG-INFO directory on sys.path (#13667)Anthony Sottile2019-05-301-1/+2
| | | | | | | | * Don't crash if there exists an EGG-INFO directory on sys.path cross-port of https://gitlab.com/python-devs/importlib_metadata/merge_requests/72 * Also catch PermissionError for windows
* bpo-34632: Add importlib.metadata (GH-12547)Jason R. Coombs2019-05-242-0/+446
| | | Add importlib.metadata module as forward port of the standalone importlib_metadata.
* bpo-36842: Implement PEP 578 (GH-12613)Steve Dower2019-05-231-2/+6
| | | Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
* bpo-36540: PEP 570 -- Implementation (GH-12701)Pablo Galindo2019-04-291-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit contains the implementation of PEP570: Python positional-only parameters. * Update Grammar/Grammar with new typedarglist and varargslist * Regenerate grammar files * Update and regenerate AST related files * Update code object * Update marshal.c * Update compiler and symtable * Regenerate importlib files * Update callable objects * Implement positional-only args logic in ceval.c * Regenerate frozen data * Update standard library to account for positional-only args * Add test file for positional-only args * Update other test files to account for positional-only args * Add News entry * Update inspect module and related tests
* bpo-35843: Implement __getitem__ for _NamespacePath (GH-11690)Anthony Sottile2019-03-081-0/+3
|
* bpo-35887: Add make regen-importlib step to importlib._bootstrap docstring ↵Nina Zakharenko2019-02-131-3/+3
| | | | (GH-11777)
* bpo-35321: Set the spec origin to frozen in frozen modules (#11732)Nina Zakharenko2019-02-051-2/+4
| | | | | | | | | | * bpo-35321: Set the spec origin to frozen in frozen modules This fix correctly sets the spec origin to "frozen" for the _frozen_importlib module. Note that the origin was already correctly set in _frozen_importlib_external. * 📜🤖 Added by blurb_it.
* bpo-35133: Fix mistakes when concatenate string literals on different lines. ↵Serhiy Storchaka2018-11-051-1/+1
| | | | | | | | | | (GH-10284) Two kind of mistakes: 1. Missed space. After concatenating there is no space between words. 2. Missed comma. Causes unintentional concatenating in a list of strings.