summaryrefslogtreecommitdiffstats
path: root/Lib/importlib
Commit message (Collapse)AuthorAgeFilesLines
* gh-87729: improve hit rate of LOAD_SUPER_ATTR specialization (#104270)Carl Meyer2023-05-111-1/+2
|
* gh-97933: (PEP 709) inline list/dict/set comprehensions (#101441)Carl Meyer2023-05-091-1/+2
| | | | Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-104310: Add importlib.util.allowing_all_extensions() (gh-104311)Eric Snow2023-05-081-0/+37
| | | (I'll be adding docs for this separately.)
* gh-98040: Remove find_loader, find_module and other deprecated APIs (#98059)Barry Warsaw2023-05-034-259/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove deprecated classes from pkgutil * Remove some other PEP 302 obsolescence * Use find_spec instead of load_module * Remove more tests of PEP 302 obsolete APIs * Remove another bunch of tests using obsolete load_modules() * Remove deleted names from __all__ * Remove obsolete footnote * imp is removed * Remove `imp` from generated stdlib names * What's new and blurb * Update zipimport documentation for the removed methods * Fix some Windows tests * Remove any test (or part of a test) that references `find_module()`. * Use assertIsNone() / assertIsNotNone() consistently. * Update Doc/reference/import.rst * We don't need pkgutil._get_spec() any more either * test.test_importlib.fixtures.NullFinder * ...BadLoaderFinder.find_module * ...test_api.InvalidatingNullFinder.find_module * ...test.test_zipimport test of z.find_module * Suppress cross-references to find_loader and find_module * Suppress cross-references to Finder * Suppress cross-references to pkgutil.ImpImporter and pkgutil.ImpLoader --------- Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net> Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
* gh-87729: specialize LOAD_SUPER_ATTR_METHOD (#103809)Carl Meyer2023-04-251-2/+3
|
* gh-87729: add LOAD_SUPER_ATTR instruction for faster super() (#103497)Carl Meyer2023-04-241-2/+3
| | | | | This speeds up `super()` (by around 85%, for a simple one-level `super().meth()` microbenchmark) by avoiding allocation of a new single-use `super()` object on each use.
* gh-103661: Apply bugfix from importlib_metadata 6.5.1 and restore test. ↵Jason R. Coombs2023-04-221-12/+14
| | | | (#103681)
* Sync with importlib_metadata 6.5 (GH-103584)Jason R. Coombs2023-04-213-20/+127
|
* Remove double space in import error message (#103458)Ned Batchelder2023-04-141-1/+1
|
* GH-103082: Implementation of PEP 669: Low Impact Monitoring for CPython ↵Mark Shannon2023-04-121-1/+2
| | | | | | | | | | (GH-103083) * The majority of the monitoring code is in instrumentation.c * The new instrumentation bytecodes are in bytecodes.c * legacy_tracing.c adapts the new API to the old sys.setrace and sys.setprofile APIs
* GH-102700: allow built-in modules to be submodules (GH-103162)Brett Cannon2023-04-061-2/+0
|
* GH-88691: Shrink the CALL caches (GH-103230)Brandt Bucher2023-04-051-1/+2
|
* GH-89987: Shrink the BINARY_SUBSCR caches (GH-103022)Brandt Bucher2023-03-291-1/+3
|
* GH-100982: Break up COMPARE_AND_BRANCH (GH-102801)Brandt Bucher2023-03-231-2/+2
|
* gh-102859: Remove JUMP_IF_FALSE_OR_POP and JUMP_IF_TRUE_OR_POP (#102870)Irit Katriel2023-03-221-1/+2
|
* GH-90997: Shrink the LOAD_GLOBAL caches (#102569)Brandt Bucher2023-03-111-4/+9
|
* gh-102515: Remove unused imports in the `Lib/` directory (#102516)Alex Waygood2023-03-081-1/+0
|
* gh-97930: Apply changes from importlib_resources 5.12. (GH-102010)Jason R. Coombs2023-02-183-42/+67
|
* gh-101766: Fix refleak for _BlockingOnManager resources from test suite ↵Dong-hee Na2023-02-171-5/+0
| | | | level (gh-101988)
* gh-101766: Fix refleak for _BlockingOnManager resources (gh-101942)Dong-hee Na2023-02-171-0/+5
|
* gh-101799: implement PREP_RERAISE_STAR as an intrinsic function (#101800)Irit Katriel2023-02-141-1/+2
|
* GH-87849: Simplify stack effect of SEND and specialize it for generators and ↵Mark Shannon2023-02-131-1/+2
| | | | coroutines. (GH-101788)
* gh-101632: Add the new RETURN_CONST opcode (#101633)penguin_wwy2023-02-071-1/+2
|
* Fix incorrect versions in magic number comments (GH-101301)Brandt Bucher2023-01-251-8/+8
|
* GH-100762: Don't call `gen.throw()` in `gen.close()`, unless necessary. ↵Mark Shannon2023-01-241-2/+3
| | | | | | (GH-101013) * Store exception stack depth in YIELD_VALUE's oparg and use it avoid expensive gen.throw() in gen.close() where possible.
* gh-91351: Fix some bugs in importlib handling of re-entrant imports (GH-94504)Jean-Paul Calderone2023-01-211-37/+196
| | | Co-authored-by: Brett Cannon <brett@python.org>
* GH-100982: Add `COMPARE_AND_BRANCH` instruction (GH-100983)Mark Shannon2023-01-161-1/+2
|
* GH-100923: Embed jump mask in `COMPARE_OP` oparg (GH-100924)Mark Shannon2023-01-111-1/+2
|
* GH-99005: More intrinsics (GH-100774)Mark Shannon2023-01-061-1/+2
| | | * Remove UNARY_POSITIVE, LIST_TO_TUPLE and ASYNC_GEN_WRAP, replacing them with intrinsics.
* GH-99005: Add `CALL_INTRINSIC_1` instruction (GH-100771)Mark Shannon2023-01-051-1/+2
| | | | | | | | * Remove PRINT_EXPR instruction * Remove STOPITERATION_ERROR instruction * Remove IMPORT_STAR instruction
* gh-97930: Apply changes from importlib_resources 5.10. (GH-100598)Jason R. Coombs2023-01-014-57/+100
|
* gh-100585: Fixed a bug where importlib.resources.as_file was leaving file ↵Samet YASLAN2022-12-281-1/+1
| | | | | | | pointers open (GH-100586) * gh-100585: Fixed open fp bug in the imporlib module * Added news for gh-100585
* closes gh-99508: fix `TypeError` in `Lib/importlib/_bootstrap_external.py` ↵Nikita Sobolev2022-11-231-1/+2
| | | | (GH-99635)
* gh-99254: remove all unused consts from code objects (GH-99255)Irit Katriel2022-11-111-1/+2
|
* gh-98139: enhance namespace package reprAnh71me2022-11-061-1/+1
|
* GH-96793: Implement PEP 479 in bytecode. (GH-99006)Mark Shannon2022-11-031-1/+2
| | | | | * Handle converting StopIteration to RuntimeError in bytecode. * Add custom instruction for converting StopIteration into RuntimeError.
* GH-96793: Change `FOR_ITER` to not pop the iterator on exhaustion. (GH-96801)Mark Shannon2022-10-271-1/+2
| | | | Change FOR_ITER to have the same stack effect regardless of whether it branches or not. Performance is unchanged as FOR_ITER (and specialized forms jump over the cleanup code).
* gh-97930: Merge with importlib_resources 5.9 (GH-97929)Jason R. Coombs2022-10-164-29/+86
| | | | | * Merge with importlib_resources 5.9 * Update changelog
* gh-86298: Ensure that __loader__ and __spec__.loader agree in ↵Barry Warsaw2022-10-071-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | warnings.warn_explicit() (GH-97803) In `_warnings.c`, in the C equivalent of `warnings.warn_explicit()`, if the module globals are given (and not None), the warning will attempt to get the source line for the issued warning. To do this, it needs the module's loader. Previously, it would only look up `__loader__` in the module globals. In https://github.com/python/cpython/issues/86298 we want to defer to the `__spec__.loader` if available. The first step on this journey is to check that `loader == __spec__.loader` and issue another warning if it is not. This commit does that. Since this is a PoC, only manual testing for now. ```python # /tmp/foo.py import warnings import bar warnings.warn_explicit( 'warning!', RuntimeWarning, 'bar.py', 2, module='bar knee', module_globals=bar.__dict__, ) ``` ```python # /tmp/bar.py import sys import os import pathlib # __loader__ = pathlib.Path() ``` Then running this: `./python.exe -Wdefault /tmp/foo.py` Produces: ``` bar.py:2: RuntimeWarning: warning! import os ``` Uncomment the `__loader__ = ` line in `bar.py` and try it again: ``` sys:1: ImportWarning: Module bar; __loader__ != __spec__.loader (<_frozen_importlib_external.SourceFileLoader object at 0x109f7dfa0> != PosixPath('.')) bar.py:2: RuntimeWarning: warning! import os ``` Automerge-Triggered-By: GH:warsaw
* gh-82874: Convert remaining importlib format uses to f-str. (#98005)Gregory P. Smith2022-10-074-27/+23
| | | f-yes
* gh-97850: Remove deprecated functions from `importlib.utils` (#97898)Nikita Sobolev2022-10-071-87/+0
| | | | | * gh-97850: Remove deprecated functions from `importlib.utils` * Rebase and remove `set_package` from diff
* bpo-38693: Use f-strings instead of str.format() within importlib (#17058)Gregory P. Smith2022-10-061-26/+23
| | | | | | | | | This is a small performance improvement, especially for one or two hot places such as _handle_fromlist() that are called a lot and the .format() method was being used just to join two strings with a dot. Otherwise it is merely a readability improvement. We keep `_ERR_MSG` and `_ERR_MSG_PREFIX` as those may be used elsewhere for canonical looking error messages.
* gh-65961: Do not rely solely on `__cached__` (GH-97990)Brett Cannon2022-10-061-10/+18
| | | Make sure `__spec__.cached` (at minimum) can be used.
* gh-97781: Apply changes from importlib_metadata 5. (GH-97785)Jason R. Coombs2022-10-061-201/+10
| | | | | | | * gh-97781: Apply changes from importlib_metadata 5. * Apply changes from upstream * Apply changes from upstream.
* gh-65961: Raise `DeprecationWarning` when `__package__` differs from ↵Brett Cannon2022-10-052-21/+1
| | | | | | | `__spec__.parent` (#97879) Also remove `importlib.util.set_package()` which was already slated for removal. Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* gh-97850: Remove all known instances of module_repr() (#97876)Barry Warsaw2022-10-051-22/+0
| | | Remove all known instances of module_repr()
* gh-93554: Conditional jump opcodes only jump forward (GH-96318)Irit Katriel2022-09-011-1/+2
|
* GH-90997: Wrap yield from/await in a virtual try/except StopIteration (GH-96010)Brandt Bucher2022-08-191-2/+2
|
* gh-94619: Remove long deprecated methods module_repr() and load_module() ↵Barry Warsaw2022-08-053-32/+1
| | | | | | | | | | | | | | | (#94624) * gh-94619: Remove long deprecated methods module_repr() and load_module() Closes #94619 * Update Misc/NEWS.d/next/Library/2022-07-06-14-57-33.gh-issue-94619.PRqKVX.rst Fix typo Co-authored-by: Brett Cannon <brett@python.org> Co-authored-by: Brett Cannon <brett@python.org>
* gh-91181: drop support for bytes on sys.path (GH-31934)Thomas Grainger2022-07-171-1/+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>