| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
create_module() is missing.
|
| |
|
| |
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
| |
Along the way, dismantle importlib._bootstrap._SpecMethods as it was
no longer relevant and constructing the new function required
partially dismantling the class anyway.
|
| |
|
|
|
|
| |
The function is also moved to importlib.util.
|
| |
|
| |
|
|
|
|
| |
source code.
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
| |
deprecation of imp.get_magic().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
control whether to reset the module's __name__ attribute in case a
reload is being done.
|
|
|
|
| |
explains better what the context manager is providing.
|
|
|
|
|
| |
and __package__ unconditionally in order to do the right thing for
reloading.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
set __loader__ on a module when set to None.
Thanks to G?kcen Eraslan for the fix.
|
|
This should make the Linux distros happy as it is now easier to leave
importlib's tests out of their base Python distribution.
|