| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
(GH-11777)
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
| |
BytesWarning no longer emitted when the fromlist argument of
__import__() or the __all__ attribute of the module contain bytes
instances.
|
|
|
|
| |
(#3834)
|
|
|
|
|
|
| |
* Trivial cleanups following bpo-31370
* Also cleanup the "importlib._bootstrap_external" module
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
(#2639)
instead of failing with SystemError.
Relative import from non-package now fails with ImportError rather than
SystemError.
|
|
|
|
|
|
| |
* 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
|
|
|
|
| |
(#2580)
|
|
|
| |
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.
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|