| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
* Always return bytes from _HackedGetData.get_data().
Ensure the imp.load_source shim always returns bytes by reopening the file in
binary mode if needed. Hash-based pycs have to receive the source code in bytes.
It's tempting to change imp.get_suffixes() to always return 'rb' as a mode, but
that breaks some stdlib tests and likely 3rdparty code, too.
|
|
|
|
|
| |
Bug didn't manifest itself when importing a module with source as .py files are always the first on the search path. The issue only showed up in bytecode-only packages where the calculated file path would be ``__init__.py/__init__.pyc``.
Patch by Alexandru Ardelean.
|
|\ |
|
| |
| |
| |
| |
| |
| | |
type issues be about 'path' instead of 'name'.
Thanks to Lev Maximov for the patch.
|
|/ |
|
|
|
|
|
|
|
|
| |
To resolve a compatibility problem found with py2exe and
pywin32, imp.load_dynamic() once again ignores previously loaded modules
to support Python modules replacing themselves with extension modules.
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.
|
| |
|
|\ |
|
| |
| |
| |
| | |
Patch by Jacinda Shelly.
|
| |
| |
| |
| |
| |
| | |
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.
|
| | |
|
|/
|
|
|
|
| |
Along the way, dismantle importlib._bootstrap._SpecMethods as it was
no longer relevant and constructing the new function required
partially dismantling the class anyway.
|
| |
|
| |
|
|\ |
|
| |
| |
| |
| | |
multiple times.
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| | |
To make sure there is no issue with code that is both Python 2 and 3
compatible, there are no plans to remove the module any sooner than
Python 4 (unless the community moves to Python 3 solidly before then).
|
| |
| |
| |
| |
| | |
source_from_cache(), finishing the work introduced in changset
4134:9cacdb9d0c59.
|
| | |
|
| | |
|
| |
| |
| |
| | |
deprecation of imp.get_magic().
|
| |
| |
| |
| |
| |
| | |
implementing in code) the deprecation of imp.reload().
Thanks to Berker Peksag for the patch.
|
|/
|
|
| |
ModuleNotFoundError.
|
|
|
|
|
|
|
| |
trying to load an extension module.
While at it, also add a proper unittest.skipIf() guard to another test
involving imp.load_dynamic().
|
|
|
|
|
|
|
|
|
|
|
|
| |
modules which will typically work when reloaded.
A hack is used to support these functions as their API allowed them to
pass in a file object but then operate as if import had loaded them.
Unfortunately the hack kept a reference around for the file object
passed in which would be unusable on reload since it had been closed.
The solution is to simply use the hack for the initial load but then a
proper loader on the module so that imp.reload() at least has a chance
to work.
|
|
|
|
|
|
|
| |
does not support dynamic loading (e.g. Atari), so make sure that imp
doesn't assume it always exists.
Patch by Christian Heimes.
|
| |
|
|
|
|
|
| |
module again. Also took the opportunity to stop accidentally exporting
_imp.extension_suffixes() as public.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Lib/imp.py for imp.source_from_cache() instead of its own C version.
Also change PyImport_ExecCodeModuleObject() to not infer the source
path from the bytecode path like
PyImport_ExecCodeModuleWithPathnames() does. This makes the function
less magical.
This also has the side-effect of removing all uses of MAXPATHLEN in
Python/import.c which can cause failures on really long filenames.
|
|
|
|
| |
Lib/imp.py.
|
|
|
|
|
|
| |
NotimplementedError when sys.implementation.cache_tag is None.
Thanks to Pranav Ravichandran for taking an initial stab at the patch.
|
|
|
|
|
|
| |
importlib._bootstrap in imp to fix a grammatical mistake.
Thanks to Marc Abramowitz for the patch.
|
|
|
|
|
|
|
| |
Also eliminates some C code in Python/import.c as well.
Patch by Eric Snow with verification by comparing against another
patch from Jeff Knupp.
|
|
|
|
|
| |
that they are deprecated (previous commit documented this fact in the
module docs).
|
|
|
|
|
|
|
|
|
|
| |
importlib.abc.FileLoader.load_module()/get_filename() and
importlib.machinery.ExtensionFileLoader.load_module() have their
single argument be optional as the loader's constructor has all the
ncessary information.
This allows for the deprecation of
imp.load_source()/load_compile()/load_package().
|
|
|
|
|
|
|
|
|
|
|
| |
importlib.machinery that provide the suffix details for import.
The attributes were not put on imp so as to compartmentalize
everything importlib needs for setting up imports in
importlib.machinery.
This also led to an indirect deprecation of inspect.getmoduleinfo() as
it directly returned imp.get_suffix's returned tuple which no longer
makes sense.
|
| |
|
|
|
|
|
|
| |
This introduces a new function, imp.extension_suffixes(), which is
currently undocumented. That is forthcoming once issue #14657 is
resolved and how to expose file suffixes is decided.
|
| |
|
| |
|
|
|
|
| |
Thanks to Eric Snow for the patch.
|
| |
|
|
|
|
|
| |
This time also recreating the Python/importlib.h file to make
make happy. See the ticket for details.
|
|
|
|
| |
the buildbots to fail.
|
| |
|
|
|
|
|
|
|
|
| |
importlib.machinery.(FileFinder, SourceFileLoader,
_SourcelessFileLoader, ExtensionFileLoader).
This exposes all of importlib's mechanisms that will become public on
the sys module.
|