summaryrefslogtreecommitdiffstats
path: root/Lib/importlib
Commit message (Collapse)AuthorAgeFilesLines
* Prevent test_inspect from keeping alive a ton of frames and local variables ↵Antoine Pitrou2012-06-171-1/+1
| | | | | | by way of a global variable keeping a reference to a traceback. Should fix some buildbot failures.
* Issue #14657: The frozen instance of importlib used for bootstrap is now ↵Antoine Pitrou2012-06-171-8/+15
| | | | also the module imported as importlib._bootstrap.
* Issue #14938: importlib.abc.SourceLoader.is_package() now takes theBrett Cannon2012-06-162-3/+6
| | | | | | | | | module name into consideration when determining whether a module is a package or not. This prevents importing a module's __init__ module directly and having it considered a package, which can lead to duplicate sub-modules. Thanks to Ronan Lamy for reporting the bug.
* Tweak importlib._bootstrap to avoid zero-argument super so I can work on ↵Nick Coghlan2012-05-271-1/+3
| | | | issue #14857 without breaking imports
* Remove some redundant decorators.Brett Cannon2012-05-261-2/+0
|
* Whitespace cleanup.Eric V. Smith2012-05-251-4/+4
|
* issue 14660: Implement PEP 420, namespace packages.Eric V. Smith2012-05-253-41/+160
|
* Issue #9260: A finer-grained import lock.Antoine Pitrou2012-05-172-13/+293
| | | | | Most of the import sequence now uses per-module locks rather than the global import lock, eliminating well-known issues with threads and imports.
* Add importlib.util.resolve_name().Brett Cannon2012-05-132-1/+55
|
* Issue #13959: Introduce importlib.find_loader().Brett Cannon2012-05-122-1/+73
| | | | | | The long-term goal is to deprecate imp.find_module() in favour of this API, but it will take some time as some APIs explicitly return/use what imp.find_module() returns.
* Issue #13959: HaveBrett Cannon2012-05-113-10/+59
| | | | | | | | | | 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-117-34/+45
| | | | | | | | | | | 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.
* Issue #14764: Update importlib.test.benchmark to work in a world whereBrett Cannon2012-05-111-0/+14
| | | | import machinery is no longer implicit.
* Issue #14583: Fix importlib bug when a package's __init__.py would first ↵Antoine Pitrou2012-05-073-2/+62
| | | | import one of its modules then raise an error.
* Clean up a docstring.Brett Cannon2012-05-041-6/+1
|
* Jython-friendly tweak.Brett Cannon2012-05-041-1/+1
|
* Issue #13959: Re-implement imp.get_suffixes() in Lib/imp.py.Brett Cannon2012-05-047-51/+14
| | | | | | 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-31/+31
|
* Issue #14646: __import__() now sets __loader__ if need be.Brett Cannon2012-04-272-3/+53
| | | | | | importlib.util.module_for_loader also will set __loader__ along with __package__. This is in conjunction to a forthcoming update to PEP 302 which will make these two attributes required for loaders to set.
* Issue #14605: Use None in sys.path_importer_cache to represent noBrett Cannon2012-04-272-44/+10
| | | | finder instead of using some (now non-existent) implicit finder.
* Issue #14605: Stop having implicit entries for sys.meta_path.Brett Cannon2012-04-272-4/+22
| | | | ImportWarning is raised if sys.meta_path is found to be empty.
* Issue #14605: Make explicit the entries on sys.path_hooks that used toBrett Cannon2012-04-263-104/+46
| | | | | | | | | | | | be implicit. Added a warning for when sys.path_hooks is found to be empty. Also changed the meaning of None in sys.path_importer_cache to represent trying sys.path_hooks again (an interpretation of previous semantics). Also added a warning for when None was found. The long-term goal is for None in sys.path_importer_cache to represent the same as imp.NullImporter: no finder found for that sys.path entry.
* Issue #14605 and #14642:Marc-Andre Lemburg2012-04-251-0/+7
| | | | | | Issue a warning in case Python\importlib.h needs to be rebuilt, but there's no Python interpreter around to freeze the bootstrap script.
* Issue #14605: Rename _SourcelessFileLoader to SourcelessFileLoader.Marc-Andre Lemburg2012-04-257-8/+8
| | | | | 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-257-8/+8
| | | | the buildbots to fail.
* Issue #14605: Rename _SourcelessFileLoader to SourcelessFileLoaderMarc-Andre Lemburg2012-04-247-8/+8
|
* Issue #14605: Expose importlib.abc.FileLoader andBrett Cannon2012-04-2213-88/+137
| | | | | | | | importlib.machinery.(FileFinder, SourceFileLoader, _SourcelessFileLoader, ExtensionFileLoader). This exposes all of importlib's mechanisms that will become public on the sys module.
* Issue #13959: Continue to try to accomodate altsep in importlib by notBrett Cannon2012-04-221-5/+11
| | | | ignoring altsep if it already exists on a path when doing a join.
* Revert to os.path.join() semantics for path manipulation in importlibBrett Cannon2012-04-221-11/+2
| | | | which is different than what imp.cache_from_source() operates on.
* Continue the good fight to get Windows to like importlib by fixing aBrett Cannon2012-04-221-1/+3
| | | | variable name.
* Have importlib look for pre-existing path separators when joiningBrett Cannon2012-04-221-2/+10
| | | | paths.
* Don't worry about moving imp.get_tag() over to Lib/imp.py.Brett Cannon2012-04-211-1/+3
|
* Issue #13959: Re-implement imp.source_from_cache() in Lib/imp.py.Brett Cannon2012-04-211-1/+5
|
* Issue #13959: Re-implement imp.cache_from_source() in Lib/imp.py.Brett Cannon2012-04-211-5/+27
|
* Make path manipulation more robust for platforms with alternative pathBrett Cannon2012-04-211-16/+27
| | | | separators.
* Issue #13959: Keep imp.get_magic() in C code, but cache in importlibBrett Cannon2012-04-201-4/+8
| | | | | | for performance. While get_magic() could move to Lib/imp.py, having to support PyImport_GetMagicNumber() would lead to equal, if not more, C code than sticking with the status quo.
* Issue #14585: test_import now runs all tests underBrett Cannon2012-04-201-0/+25
| | | | | importlib.test.import_ using builtins.__import__() instead of just the relative import tests.
* Issue #14581: Windows users are allowed to import modules w/o takingBrett Cannon2012-04-201-1/+17
| | | | | the file suffix's case into account, even when doing a case-sensitive import.
* Have importlib.test.regrtest clear sys.path_importer_cache to makeBrett Cannon2012-04-201-0/+1
| | | | sure finders from importlib are used instead of _frozen_importlib.
* don't bother keeping a set we'll never useBenjamin Peterson2012-04-181-1/+2
|
* rollback 005fd1fe31ab (see #14609 and #14582)Benjamin Peterson2012-04-182-14/+34
| | | | | Being able to overload a sys.module entry during import of a module was broken by this changeset.
* Issue #12599: Be more strict in accepting None vs. a false-like objectBrett Cannon2012-04-183-4/+27
| | | | | | | in importlib. Thanks to PJE for pointing out the issue and Nick Coghlan for filing the bug.
* Issue #14592: A relative import will raise a KeyError if __package__Brett Cannon2012-04-171-0/+5
| | | | | | or __name__ are not set in globals. Thanks to Stefan Behnel for the bug report.
* Issue #13959: Rename imp to _imp and add Lib/imp.py and beginBrett Cannon2012-04-151-30/+40
| | | | | | | rewriting functionality in pure Python. To start, imp.new_module() has been rewritten in pure Python, put into importlib (privately) and then publicly exposed in imp.
* mergeBrett Cannon2012-04-151-2/+2
|\
| * utilize startswith(tuple)Philip Jenvey2012-04-151-2/+2
| |
* | Issue #14582: Import returns the module returned by a loader insteadBrett Cannon2012-04-152-34/+14
|/ | | | | | | | | | | | of sys.modules when possible. This is being done for two reasons. One is to gain a little bit of performance by skipping an unnecessary dict lookup in sys.modules. But the other (and main) reason is to be a little bit more clear in how things should work from the perspective of import's interactions with loaders. Otherwise loaders can easily forget to return the module even though PEP 302 explicitly states they are expected to return the module they loaded.
* Handle importing pkg.mod by executingBrett Cannon2012-04-152-1/+10
| | | | | __import__('mod', {'__packaging__': 'pkg', level=1) w/o properly (and thus not segfaulting).
* Add some comments.Brett Cannon2012-04-141-0/+2
|
* Issue #2377: Make importlib the implementation of __import__().Brett Cannon2012-04-149-28/+40
| | | | | | | importlib._bootstrap is now frozen into Python/importlib.h and stored as _frozen_importlib in sys.modules. Py_Initialize() loads the frozen code along with sys and imp and then uses _frozen_importlib._install() to set builtins.__import__() w/ _frozen_importlib.__import__().