summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/_bootstrap.py
Commit message (Collapse)AuthorAgeFilesLines
* 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-33331: Clean modules in the reversed order in PyImport_Cleanup(). (GH-6565)Serhiy Storchaka2018-10-291-56/+62
| | | | | | Modules imported last are now cleared first at interpreter shutdown. A newly imported module is moved to the end of sys.modules, behind modules on which it depends.
* bpo-32946: Speed up "from ... import ..." from non-packages. (GH-5873)Serhiy Storchaka2018-03-111-26/+27
|
* bpo-32303 - Consistency fixes for namespace loaders (#5481)Barry Warsaw2018-02-021-0/+12
| | | | | | | * Make sure ``__spec__.loader`` matches ``__loader__`` for namespace packages. * Make sure ``__spec__.origin` matches ``__file__`` for namespace packages. https://bugs.python.org/issue32303 https://bugs.python.org/issue32305
* bpo-21720: Restore the Python 2.7 logic in handling a fromlist. (#4118)Serhiy Storchaka2017-10-261-7/+13
| | | | | | BytesWarning no longer emitted when the fromlist argument of __import__() or the __all__ attribute of the module contain bytes instances.
* bpo-31642: Restore blocking "from" import by setting None in sys.modules. ↵Serhiy Storchaka2017-10-081-1/+2
| | | | (#3834)
* Trivial cleanups following bpo-31370 (#3649)Antoine Pitrou2017-09-181-13/+1
| | | | | | * Trivial cleanups following bpo-31370 * Also cleanup the "importlib._bootstrap_external" module
* bpo-31070: Fix a race condition in importlib _get_module_lock(). (#3033)Serhiy Storchaka2017-08-091-2/+12
|
* bpo-30891: Fix again importlib _find_and_load() (#2665)Victor Stinner2017-07-211-5/+5
| | | | | | | | | Use sys.modules.get() in the "with _ModuleLockManager(name):" block to protect the dictionary key with the module lock and use an atomic get to prevent race condition. Remove also _bootstrap._POPULATE since it was unused (_bootstrap_external now has its own _POPULATE object), add a new _SENTINEL object instead.
* bpo-30876: Relative import from unloaded package now reimports the package ↵Serhiy Storchaka2017-07-121-4/+0
| | | | | | | | | (#2639) instead of failing with SystemError. Relative import from non-package now fails with ImportError rather than SystemError.
* bpo-30891: Fix importlib _find_and_load() race condition (#2646)Victor Stinner2017-07-101-28/+30
| | | | | | * Rewrite importlib _get_module_lock(): it is now responsible to hold the imp lock directly. * _find_and_load() now holds the module lock to check if name is in sys.modules to prevent a race condition
* bpo-30814: Fixed a race condition when import a submodule from a package. ↵Serhiy Storchaka2017-07-061-14/+14
| | | | (#2580)
* bpo-22257: Small changes for PEP 432. (#1728)Eric Snow2017-05-231-1/+4
| | | PEP 432 specifies a number of large changes to interpreter startup code, including exposing a cleaner C-API. The major changes depend on a number of smaller changes. This patch includes all those smaller changes.
* Issue #28026: Raise ImportError when exec_module() exists but ↵Eric Snow2016-09-081-3/+2
| | | | create_module() is missing.
* Issue #15767: Use ModuleNotFoundError.Eric Snow2016-09-071-7/+7
|
* Issue #27974: Remove importlib._bootstrap._ManageReload.Brett Cannon2016-09-061-17/+0
| | | | Class was dead code. Thanks to Xiang Zhang for the patch.
* Issue #26972: Fix some mistakes in importlib-related docstrings.Brett Cannon2016-07-081-3/+3
| | | | Thanks to Oren Milman for the patch.
* Issue #27076: Merge spelling from 3.5Martin Panter2016-05-261-1/+1
|\
| * Issue #27076: Doc, comment and tests spelling fixesMartin Panter2016-05-261-1/+1
| | | | | | | | Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
* | Fix bug in __import__ during Python shutdownVictor Stinner2016-03-241-2/+9
| | | | | | | | | | | | Issue #26637: The importlib module now emits an ImportError rather than a TypeError if __import__() is tried during the Python shutdown process but sys.path is already cleared (set to None).
* | Merge for issue #26367Brett Cannon2016-02-201-1/+4
|\ \ | |/
| * Issue #26367: Have importlib.__init__() raise RuntimeError whenBrett Cannon2016-02-201-1/+1
| | | | | | | | | | | | | | 'level' is specified but no __package__. This brings the function inline with builtins.__import__(). Thanks to Manuel Jacob for the patch.
* | Issue #25791: Warn when __package__ != __spec__.parent.Brett Cannon2016-01-221-3/+9
| | | | | | | | | | | | | | | | | | In a previous change, __spec__.parent was prioritized over __package__. That is a backwards-compatibility break, but we do eventually want __spec__ to be the ground truth for module details. So this change reverts the change in semantics and instead raises an ImportWarning when __package__ != __spec__.parent to give people time to adjust to using spec objects.
* | Issue #25791: Raise an ImportWarning when __spec__ or __package__ areBrett Cannon2016-01-151-0/+6
|/ | | | | | | | not defined for a relative import. This is the start of work to try and clean up import semantics to rely more on a module's spec than on the myriad attributes that get set on a module. Thanks to Rose Ames for the patch.
* Issue #24769: Interpreter now starts properly when dynamic loadingLarry Hastings2015-08-251-1/+1
| | | | is disabled. Patch by Petr Viktorin.
* PEP 489: Multi-phase extension module initializationNick Coghlan2015-05-231-10/+13
| | | | | | | | | | | | | | | | | | | | | | | Known limitations of the current implementation: - documentation changes are incomplete - there's a reference leak I haven't tracked down yet The leak is most visible by running: ./python -m test -R3:3 test_importlib However, you can also see it by running: ./python -X showrefcount Importing the array or _testmultiphase modules, and then deleting them from both sys.modules and the local namespace shows significant increases in the total number of active references each cycle. By contrast, with _testcapi (which continues to use single-phase initialisation) the global refcounts stabilise after a couple of cycles.
* Issue #24192: Fix namespace package imports.Eric Snow2015-05-161-5/+14
|
* Issue #23911: Move path-based bootstrap code to a separate frozen module.Eric Snow2015-05-031-1332/+11
|
* Issue #23731: Implement PEP 488.Brett Cannon2015-04-131-27/+51
| | | | | | The concept of .pyo files no longer exists. Now .pyc files have an optional `opt-` tag which specifies if any extra optimizations beyond the peepholer were applied.
* Issue #23014: Make importlib.abc.Loader.create_module() required whenBrett Cannon2015-01-091-0/+14
| | | | | | | | | importlib.abc.Loader.exec_module() is also defined. Before this change, create_module() was optional **and** could return None to trigger default semantics. This change now reduces the options for choosing default semantics to one and in the most backporting-friendly way (define create_module() to return None).
* - Issue #22966: Fix __pycache__ pyc file name clobber when pyc_compile isBarry Warsaw2014-12-011-2/+2
|\ | | | | | | | | asked to compile a source file containing multiple dots in the source file name.
| * - Issue #22966: Fix __pycache__ pyc file name clobber when pyc_compile isBarry Warsaw2014-12-011-2/+2
| | | | | | | | | | asked to compile a source file containing multiple dots in the source file name.
* | Issue #19720: Suppressed context for some exceptions in importlib.Serhiy Storchaka2014-11-211-1/+1
| |
* | Issue #22834: Have import suppress FileNotFoundError when the currentBrett Cannon2014-11-211-1/+6
| | | | | | | | | | | | working directory no longer exists. Thanks to Martin Panter for the bug report.
* | Issue #21052: Don't raise ImportWarning for sys.meta_path orBrett Cannon2014-10-101-2/+2
| | | | | | | | | | | | sys.path_hooks when set to None during interpreter shutdown. Thanks to Martin Panter for the initial bug report.
* | Fix a parameter name to make sense againBrett Cannon2014-05-301-2/+3
| |
* | Issue #20383: Introduce importlib.util.module_from_spec().Brett Cannon2014-05-301-218/+163
| | | | | | | | | | | | Along the way, dismantle importlib._bootstrap._SpecMethods as it was no longer relevant and constructing the new function required partially dismantling the class anyway.
* | Merge from 3.4 (for #21226).Eric Snow2014-05-131-0/+23
|\ \ | |/
| * Issue #21226: Set all attrs in PyImport_ExecCodeModuleObject.Eric Snow2014-05-121-0/+23
| |
| * Issue #20763: Fix importlib.machinery.PathFinder to supportBrett Cannon2014-02-261-1/+1
| | | | | | | | | | | | PathEntryFinder instances which only define find_module(). Reported by Yukihiro Nakadaira.
| * update magic number for #20625Benjamin Peterson2014-02-191-1/+2
| |
* | PEP 465: a dedicated infix operator for matrix multiplication (closes #21176)Benjamin Peterson2014-04-101-1/+2
| |
* | Issue #20763: Fix importlib.machinery.PathFinder to supportBrett Cannon2014-02-261-1/+1
| | | | | | | | | | | | PathEntryFinder instances which only define find_module(). Reported by Yukihiro Nakadaira.
* | update magic number for #20625Benjamin Peterson2014-02-191-1/+2
|/
* Issue 19713: Remove PEP 451-related code that should have been factored out.Eric Snow2014-01-081-24/+4
| | | | | | This code was an artifact of issuing a DeprecationWarning for the lack of loader.exec_module(). However, we have deferred such warnings to later Python versions.
* Issue 19713: Add PEP 451-related deprecations.Eric Snow2014-01-071-25/+99
|
* Remove dead PEP 451 code.Eric Snow2014-01-071-10/+0
|
* Issue #19927: Add __eq__ to path-based loaders in importlib.Eric Snow2014-01-041-0/+14
|
* Issue #20097: Fix bad use of "self" in importlib's WindowsRegistryFinder.Eric Snow2014-01-031-1/+1
|