summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/_bootstrap.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.6] bpo-31070: Fix a race condition in importlib _get_module_lock(). ↵Serhiy Storchaka2017-08-091-2/+12
| | | | | (GH-3033). (#3038) (cherry picked from commit 9b0d1d647e3d2ec9d299e5c9f49b02fbbb810a5a)
* bpo-30891: Fix again importlib _find_and_load() (#2665) (#2801)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. (cherry picked from commit e72b1359f81d1dd42bd8a5c5cc2b3928b74f8023)
* [3.6] bpo-30876: Relative import from unloaded package now reimports the ↵Serhiy Storchaka2017-07-161-4/+0
| | | | | | | | | package (GH-2639) (#2676) instead of failing with SystemError. Relative import from non-package now fails with ImportError rather than SystemError. (cherry picked from commit 8a9cd20edca7d01b68292036029ae3735ce65edd)
* bpo-30891: Fix importlib _find_and_load() race condition (#2646) (#2651)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 (cherry picked from commit 4f9a446f3fb42f800e73cd9414dd1eccb3ca4fa7)
* [3.6] bpo-30814: Fixed a race condition when import a submodule from a ↵Serhiy Storchaka2017-07-061-14/+14
| | | | | package. (GH-2580). (#2598) (cherry picked from commit b4baacee1adc06edbe30ac7574d17a8cd168e2e0)
* 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
|
* Remove some dead code in importlib, introduced with the PEP 451 patch.Eric Snow2013-12-191-8/+3
| | | | | | | Early in the PEP 451 implementation some of the importlib loaders had their own _get_spec() methods to simplify accommodating them. However, later implementations removed the need. They simply failed to remove this code at the same time. :)
* Issue #18864: Add a setter for ModuleSpec.has_location.Eric Snow2013-12-111-0/+4
|
* Issue #19698: Remove exec_module() from the built-in and extensionBrett Cannon2013-11-291-27/+36
| | | | | | | | | | | | | module loaders. Due to the fact that the call signatures for extension modules and built-in modules does not allow for the specifying of what module to initialize and that on Windows all extension modules are built-in modules, work to clean up built-in and extension module initialization will have to wait until Python 3.5. Because of this the semantics of exec_module() would be incorrect, so removing the methods for now is the best option; load_module() is still used as a fallback by importlib and so this won't affect semantics.
* User the repr for a module name in more placesBrett Cannon2013-11-221-6/+6
|
* Remove a commented-out lineBrett Cannon2013-11-221-2/+0
|
* Don't assume trying to find a builtin will succeed (e.g. posix isn't on Windows)Brett Cannon2013-11-221-0/+2
|
* Implement PEP 451 (ModuleSpec).Eric Snow2013-11-221-273/+822
|
* Abstract out stat calls in importlib for easier experimentation.Brett Cannon2013-11-011-5/+15
|
* Issue #19410: Put back in special-casing of '' forBrett Cannon2013-11-011-1/+1
| | | | | | | | | importlib.machinery.FileFinder. While originally moved to stop special-casing '' as PathFinder farther up the typical call chain now uses the cwd in the instance of '', it was deemed an unnecessary risk to breaking subclasses of FileFinder to take the special-casing out.