aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/importlib/util.py
Commit message (Collapse)AuthorAge
* gh-82874: Convert remaining importlib format uses to f-str. (#98005)Gregory P. Smith2022-10-06
| | | f-yes
* gh-97850: Remove deprecated functions from `importlib.utils` (#97898)Nikita Sobolev2022-10-06
| | | | | * gh-97850: Remove deprecated functions from `importlib.utils` * Rebase and remove `set_package` from diff
* gh-65961: Raise `DeprecationWarning` when `__package__` differs from ↵Brett Cannon2022-10-05
| | | | | | | `__spec__.parent` (#97879) Also remove `importlib.util.set_package()` which was already slated for removal. Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* bpo-43720: Update import-related stdlib deprecation messages to say they ↵Brett Cannon2021-04-03
| | | | will be removed in Python 3.12 (GH-25167)
* bpo-42403: Fix pyflakes warnings in importlib (GH-23396)Victor Stinner2020-11-19
| | | Remove unused imports and unused local variables.
* bpo-41006: importlib.util no longer imports typing (GH-20938)Victor Stinner2020-06-17
| | | | Create importlib._abc submodule to avoid importing typing when importlib.util is imported. Move Loader ABC into importlib._abc.
* bpo-37444: Update differing exception between builtins and importlib (GH-14869)Ngalim Siregar2019-08-02
| | | | | | | | | | 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-30436: Add missing space in importlib.util.find_spec() error message ↵Zackery Spytz2018-06-07
| | | | (GH-7385)
* closes bpo-31650: PEP 552 (Deterministic pycs) implementation (#4575)Benjamin Peterson2017-12-09
| | | | | | | | | | | | | | | | | | | | | | | | | 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-30436: Raise ModuleNotFoundError for importlib.util.find_spec() when ↵Milan Oberkirch2017-06-14
| | | | | parent isn't a package (GH-1899) Previously AttributeError was raised, but that's not very reflective of the fact that the requested module can't be found since the specified parent isn't actually a package.
* Issue #26186: Remove the restriction that built-in and extensionBrett Cannon2016-06-25
| | | | | | | | modules can't be lazily loaded. Thanks to Python 3.6 allowing for types.ModuleType to have its __class__ mutated, the restriction can be lifted by calling create_module() on the wrapped loader.
* Merge from 3.5Brett Cannon2016-06-25
|\
| * Fix a scoping issue where an UnboundLocalError was triggered if aBrett Cannon2016-06-25
| | | | | | | | lazy-loaded module was already in sys.modules.
* | Merge for issue #26186Brett Cannon2016-02-20
|\|
| * Issue #26186: Remove an invalid type check inBrett Cannon2016-02-20
| | | | | | | | | | | | | | | | | | | | | | importlib.util.LazyLoader. The class was checking its argument as to whether its implementation of create_module() came directly from importlib.abc.Loader. The problem is that the classes coming from imoprtlib.machinery do not directly inherit from the ABC as they come from _frozen_importlib. Because the documentation has always said that create_module() was ignored, the check has simply been removed.
* | Issue #25771: Tweak ValueError message when package isn't specifiedBrett Cannon2015-12-04
|/ | | | | | for importlib.util.resolve_name() but is needed. Thanks to Martin Panter for the bug report.
* Issue #23911: Move path-based bootstrap code to a separate frozen module.Eric Snow2015-05-02
|
* Issue #19720: Suppressed context for some exceptions in importlib.Serhiy Storchaka2014-11-21
|
* Issue #20383: Introduce importlib.util.module_from_spec().Brett Cannon2014-05-30
| | | | | | Along the way, dismantle importlib._bootstrap._SpecMethods as it was no longer relevant and constructing the new function required partially dismantling the class anyway.
* Issue #17621: Introduce importlib.util.LazyLoader.Brett Cannon2014-04-04
|
* Issue 19944: Fix importlib.find_spec() so it imports parents as needed.Eric Snow2014-01-25
| | | | The function is also moved to importlib.util.
* Issue 19713: Add PEP 451-related deprecations.Eric Snow2014-01-06
|
* Implement PEP 451 (ModuleSpec).Eric Snow2013-11-22
|
* Issue #18076: Introduce imoportlib.util.decode_source().Brett Cannon2013-06-16
| | | | | | | The helper function makes it easier to implement imoprtlib.abc.InspectLoader.get_source() by making that function require just the raw bytes for source code and handling all other details.
* Issue #17907: touch up the code for imp.new_module().Brett Cannon2013-06-14
|
* Issue #18192: Introduce importlib.util.MAGIC_NUMBER and document theBrett Cannon2013-06-14
| | | | deprecation of imp.get_magic().
* fix whitespaceBrett Cannon2013-05-31
|
* Issues #18088, 18089: IntroduceBrett Cannon2013-05-31
| | | | | | | | | | | | | | | | | | | | | importlib.abc.Loader.init_module_attrs() and implement importlib.abc.InspectLoader.load_module(). The importlib.abc.Loader.init_module_attrs() method sets the various attributes on the module being loaded. It is done unconditionally to support reloading. Typically people used importlib.util.module_for_loader, but since that's a decorator there was no way to override it's actions, so init_module_attrs() came into existence to allow for overriding. This is also why module_for_loader is now pending deprecation (having its other use replaced by importlib.util.module_to_load). All of this allowed for importlib.abc.InspectLoader.load_module() to be implemented. At this point you can now implement a loader with nothing more than get_code() (which only requires get_source(); package support requires is_package()). Thanks to init_module_attrs() the implementation of load_module() is basically a context manager containing 2 methods calls, a call to exec(), and a return statement.
* Rename importlib.util.ModuleManager to module_to_load so that the nameBrett Cannon2013-05-30
| | | | explains better what the context manager is providing.
* Introduce importlib.util.ModuleManager which is a context manager toBrett Cannon2013-05-28
| | | | | | | | handle providing (and cleaning up if needed) the module to be loaded. A future commit will use the context manager in Lib/importlib/_bootstrap.py and thus why the code is placed there instead of in Lib/importlib/util.py.
* Add importlib.util.resolve_name().Brett Cannon2012-05-13
|
* PEP 3147Barry Warsaw2010-04-17
|
* Implement importlib.util.set_loader: a decorator to automatically setBrett Cannon2009-03-10
| | | | __loader__ on modules.
* Rename importlib.util.set___package__ to set_package.Brett Cannon2009-03-04
|
* Expose importlib.util.set___package__.Brett Cannon2009-03-02
|
* Implement the more specific PEP 302 semantics for loaders and what happens uponBrett Cannon2009-02-17
load failure in relation to reloads. Also expose importlib.util.module_for_loader to handle all of the details of this along with making sure all current loaders behave nicely.