summaryrefslogtreecommitdiffstats
path: root/Lib/imp.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-30645: don't append to an inner loop path in imp.load_package() (GH-2268)Alexandru Ardelean2017-06-231-2/+3
| | | | | 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.
* Merge for #26844Brett Cannon2016-07-151-2/+2
|\
| * Issue #26844: Fix imp.find_module() to have the exception related toBrett Cannon2016-07-151-2/+2
| | | | | | | | | | | | type issues be about 'path' instead of 'name'. Thanks to Lev Maximov for the patch.
* | Upgrade the imp module's deprecation to DeprecationWarning.Brett Cannon2015-10-161-1/+1
|/
* Close #24748: Restore imp.load_dynamic compatibilityNick Coghlan2015-09-051-1/+7
| | | | | | | | 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.
* PEP 489: Multi-phase extension module initializationNick Coghlan2015-05-231-4/+29
| | | | | | | | | | | | | | | | | | | | | | | 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 #23911: Move path-based bootstrap code to a separate frozen module.Eric Snow2015-05-031-1/+2
|
* Closes #23956: Merge with 3.4Zachary Ware2015-04-141-1/+1
|\
| * Issue #23956: Fix typo in imp.py docstring.Zachary Ware2015-04-141-1/+1
| | | | | | | | Patch by Jacinda Shelly.
* | Issue #23731: Implement PEP 488.Brett Cannon2015-04-131-9/+10
| | | | | | | | | | | | 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.
* | Fix module deprecation warnings to have a useful stacklevelBrett Cannon2015-03-271-1/+1
| |
* | Issue #20383: Introduce importlib.util.module_from_spec().Brett Cannon2014-05-301-10/+7
|/ | | | | | Along the way, dismantle importlib._bootstrap._SpecMethods as it was no longer relevant and constructing the new function required partially dismantling the class anyway.
* Issue #15204: Deprecated the 'U' mode in file-like objects.Serhiy Storchaka2013-11-231-2/+2
|
* Implement PEP 451 (ModuleSpec).Eric Snow2013-11-221-6/+24
|
* merge for issue #18755Brett Cannon2013-08-231-2/+7
|\
| * Issue #18755: Allow imp.load_*() loaders to have get_data() calledBrett Cannon2013-08-231-2/+7
| | | | | | | | multiple times.
| * issue #18698: ensure importlib.reload() returns the module out of sys.modules.Eric Snow2013-08-151-1/+3
| |
| * #18681: Fix a NameError in imp.reload() (noticed by Weizhao Li).Ezio Melotti2013-08-101-1/+1
| |
* | Issue #18200: Back out usage of ModuleNotFoundError (8d28d44f3a9a)Brett Cannon2013-07-041-1/+1
| |
* | Issue #17177: The imp module is pending deprecation.Brett Cannon2013-06-161-51/+42
| | | | | | | | | | | | 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).
* | Issue #18194: Introduce importlib.util.cache_from_source() andBrett Cannon2013-06-151-2/+33
| | | | | | | | | | source_from_cache(), finishing the work introduced in changset 4134:9cacdb9d0c59.
* | Make it more obvious what things used in imp are snuck in through private APIsBrett Cannon2013-06-151-11/+8
| |
* | Issue #17907: touch up the code for imp.new_module().Brett Cannon2013-06-151-1/+12
| |
* | Issue #18192: Introduce importlib.util.MAGIC_NUMBER and document theBrett Cannon2013-06-141-2/+6
| | | | | | | | deprecation of imp.get_magic().
* | Issue #18193: Add importlib.reload(), documenting (but notBrett Cannon2013-06-141-23/+5
| | | | | | | | | | | | implementing in code) the deprecation of imp.reload(). Thanks to Berker Peksag for the patch.
* | Issue #18200: Update the stdlib (except tests) to useBrett Cannon2013-06-141-1/+1
|/ | | | ModuleNotFoundError.
* Issue #15902: Fix imp.load_module() to accept None as a file whenBrett Cannon2013-05-031-2/+6
| | | | | | | trying to load an extension module. While at it, also add a proper unittest.skipIf() guard to another test involving imp.load_dynamic().
* Issue #17358: imp.load_source() and load_compiled() should now returnBrett Cannon2013-04-281-2/+12
| | | | | | | | | | | | 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.
* Issue #16880: _imp.load_dynamic() is not defined on a platform thatBrett Cannon2013-03-171-2/+7
| | | | | | | does not support dynamic loading (e.g. Atari), so make sure that imp doesn't assume it always exists. Patch by Christian Heimes.
* Issue #15828: Restore support for C extension modules in imp.load_module()Nick Coghlan2012-08-311-2/+4
|
* Issue #15576: Allow extension modules to be a package's __init__Brett Cannon2012-08-101-2/+2
| | | | | module again. Also took the opportunity to stop accidentally exporting _imp.extension_suffixes() as public.
* Issues #15169, #14599: Make PyImport_ExecCodeModuleWithPathnames() useBrett Cannon2012-07-131-24/+1
| | | | | | | | | | | | 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.
* Issue #15167 (as part of #13959): imp.get_magic() is no implemented inBrett Cannon2012-07-091-2/+7
| | | | Lib/imp.py.
* Issue #15056: imp.cache_from_source() and source_from_cache() raiseBrett Cannon2012-07-091-1/+4
| | | | | | NotimplementedError when sys.implementation.cache_tag is None. Thanks to Pranav Ravichandran for taking an initial stab at the patch.
* Issue #15256: Re-use the ImportError exception message as defined byBrett Cannon2012-07-091-1/+1
| | | | | | importlib._bootstrap in imp to fix a grammatical mistake. Thanks to Marc Abramowitz for the patch.
* Issue #15166: Re-implement imp.get_tag() using sys.implementation.Brett Cannon2012-07-021-1/+6
| | | | | | | 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.
* Issue #13959: Add to imp.find_module() and load_module's docstringsBrett Cannon2012-06-151-4/+6
| | | | | that they are deprecated (previous commit documented this fact in the module docs).
* Issue #13959: HaveBrett Cannon2012-05-111-24/+36
| | | | | | | | | | 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().
* Issue #13959: Deprecate imp.get_suffixes() for new attributes onBrett Cannon2012-05-111-13/+20
| | | | | | | | | | | 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.
* don't append the bytecode suffix to the source suffixes globalBenjamin Peterson2012-05-051-2/+1
|
* Issue #13959: Re-implement imp.get_suffixes() in Lib/imp.py.Brett Cannon2012-05-041-5/+11
| | | | | | 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.
* Properly mark names in importlib._bootstrap as private.Brett Cannon2012-05-041-6/+6
|
* Re-indent.Brett Cannon2012-04-291-1/+0
|
* Issues #13959, 14647: Re-implement imp.reload() in Lib/imp.py.Brett Cannon2012-04-291-1/+32
| | | | Thanks to Eric Snow for the patch.
* Issue #13959: Re-implement imp.NullImporter in Lib/imp.py.Brett Cannon2012-04-291-2/+15
|
* Issue #14605: Rename _SourcelessFileLoader to SourcelessFileLoader.Marc-Andre Lemburg2012-04-251-1/+1
| | | | | This time also recreating the Python/importlib.h file to make make happy. See the ticket for details.
* Issue #14605: Revert renaming of _SourcelessFileLoader, since it causedMarc-Andre Lemburg2012-04-251-1/+1
| | | | the buildbots to fail.
* Issue #14605: Rename _SourcelessFileLoader to SourcelessFileLoaderMarc-Andre Lemburg2012-04-241-1/+1
|
* Issue #14605: Expose importlib.abc.FileLoader andBrett Cannon2012-04-221-3/+3
| | | | | | | | importlib.machinery.(FileFinder, SourceFileLoader, _SourcelessFileLoader, ExtensionFileLoader). This exposes all of importlib's mechanisms that will become public on the sys module.
* Fix whitespace.Brett Cannon2012-04-221-1/+0
|