| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
(GH-3033). (#3038)
(cherry picked from commit 9b0d1d647e3d2ec9d299e5c9f49b02fbbb810a5a)
|
|
|
|
|
|
|
|
|
|
| |
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)
|
|
|
|
|
|
|
|
|
| |
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)
|
|
|
|
|
|
|
| |
* 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)
|
|
|
|
|
| |
package. (GH-2580). (#2598)
(cherry picked from commit b4baacee1adc06edbe30ac7574d17a8cd168e2e0)
|
|
|
|
| |
create_module() is missing.
|
| |
|
|
|
|
| |
Class was dead code. Thanks to Xiang Zhang for the patch.
|
|
|
|
| |
Thanks to Oren Milman for the patch.
|
|\ |
|
| |
| |
| |
| | |
Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
|
| |
| |
| |
| |
| |
| | |
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).
|
|\ \
| |/ |
|
| |
| |
| |
| |
| |
| |
| | |
'level' is specified but no __package__.
This brings the function inline with builtins.__import__(). Thanks to
Manuel Jacob for the patch.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|/
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
is disabled. Patch by Petr Viktorin.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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).
|
|\
| |
| |
| |
| | |
asked to compile a source file containing multiple dots in the source file
name.
|
| |
| |
| |
| |
| | |
asked to compile a source file containing multiple dots in the source file
name.
|
| | |
|
| |
| |
| |
| |
| |
| | |
working directory no longer exists.
Thanks to Martin Panter for the bug report.
|
| |
| |
| |
| |
| |
| | |
sys.path_hooks when set to None during interpreter shutdown.
Thanks to Martin Panter for the initial bug report.
|
| | |
|
| |
| |
| |
| |
| |
| | |
Along the way, dismantle importlib._bootstrap._SpecMethods as it was
no longer relevant and constructing the new function required
partially dismantling the class anyway.
|
|\ \
| |/ |
|
| | |
|
| |
| |
| |
| |
| |
| | |
PathEntryFinder instances which only define find_module().
Reported by Yukihiro Nakadaira.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| | |
PathEntryFinder instances which only define find_module().
Reported by Yukihiro Nakadaira.
|
|/ |
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
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. :)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|