Brett Cannon
7385adc84c
Issue #15715 : Ignore failed imports triggered by the use of fromlist.
...
When the fromlist argument is specified for __import__() and the
attribute doesn't already exist, an import is attempted. If that fails
(e.g. module doesn't exist), the ImportError will now be silenced (for
backwards-compatibility). This *does not* affect
``from ... import ...`` statements.
Thanks to Eric Snow for the patch and Simon Feltman for reporting the
regression.
2012-08-17 13:21:16 -04:00
Brett Cannon
b428f47cf6
Don't overwrite a __path__ value from extension modules if already
...
set.
2012-08-11 19:43:29 -04:00
Philip Jenvey
688a551ca0
fix docstring wording
2012-08-10 16:21:35 -07:00
Brett Cannon
f410ce8c09
Issue #15502 : Refactor some code.
2012-08-10 17:41:23 -04:00
Philip Jenvey
731d48a65f
update docstring per the extension package fix, refactor
2012-08-10 11:53:54 -07:00
Brett Cannon
ac9f2f3de3
Issue #15576 : Allow extension modules to be a package's __init__
...
module again. Also took the opportunity to stop accidentally exporting
_imp.extension_suffixes() as public.
2012-08-10 13:47:54 -04:00
Brett Cannon
f4dc9204cc
Issue #15502 : Finish bringing importlib.abc in line with the current
...
state of the import system. Also make importlib.invalidate_caches()
work with sys.meta_path instead of sys.path_importer_cache to
completely separate the path-based import system from the overall
import system.
Patch by Eric Snow.
2012-08-10 12:21:12 -04:00
Brett Cannon
cb4996afe4
Issue #15471 : Don't use mutable object as default values for the
...
parameters of importlib.__import__().
2012-08-06 16:34:44 -04:00
Nick Coghlan
4941774f59
Issue #15502 : Bring the importlib.PathFinder docs and docstring more in line with the new import system documentation, and fix various parts of the new docs that weren't quite right given PEP 420 or were otherwise a bit misleading. Also note the key terminology problem still being discussed in the issue
2012-08-02 23:03:58 +10:00
Nick Coghlan
ff79486bb5
Close #15519 : Properly expose WindowsRegistryFinder in importlib and bring the name into line with normal import terminology. Original patch by Eric Snow
2012-08-02 21:45:24 +10:00
Nick Coghlan
42c0766a53
Close #15486 : Simplify the mechanism used to remove importlib frames from tracebacks when they just introduce irrelevant noise
2012-07-31 21:14:18 +10:00
Nick Coghlan
5ee9892406
Close #15425 : Eliminate more importlib related traceback noise
2012-07-29 20:30:36 +10:00
Martin v. Löwis
e3010a8d12
Issue #14578 : Support modules registered in the Windows registry again.
...
Patch by Amaury Forgeot d'Arc.
2012-07-28 21:33:05 +02:00
Martin v. Löwis
7e39572aa8
Issue #15466 : Stop using TYPE_INT64 in marshal,
...
to make importlib.h (and other byte code files) equal between 32-bit
and 64-bit systems.
2012-07-28 19:44:05 +02:00
Nick Coghlan
2824cb507d
Issue #15343 : A lot more than just unicode decoding can go wrong when retrieving a source file
2012-07-15 22:12:14 +10:00
Brett Cannon
a6473f9cfd
Issues #15169 , #14599 : Make PyImport_ExecCodeModuleWithPathnames() use
...
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.
2012-07-13 13:57:03 -04:00
Brett Cannon
461c813164
Issue #15111 : When a module was imported using a 'from import'
...
statement (e.g. ``from distutils import msvc9compiler``) that triggers
an ImportError of its own (e.g. the non-existence of winreg), let that
exception propagate instead of raising a generic ImportError for the
module being requested (e.g. msvc9compiler).
2012-07-10 10:05:00 -04:00
Brett Cannon
77b2abd094
Issue #15167 (as part of #13959 ): imp.get_magic() is no implemented in
...
Lib/imp.py.
2012-07-09 16:09:00 -04:00
Brett Cannon
19a2f5961c
Issue #15056 : imp.cache_from_source() and source_from_cache() raise
...
NotimplementedError when sys.implementation.cache_tag is None.
Thanks to Pranav Ravichandran for taking an initial stab at the patch.
2012-07-09 13:58:07 -04:00
Amaury Forgeot d'Arc
ae7b8f07c1
Issue #15110 : Also hide importlib frames when importing a builtin module fails.
2012-07-08 20:52:38 +02:00
Antoine Pitrou
bc07a5c913
Issue #15110 : Fix the tracebacks generated by "import xxx" to not show the importlib stack frames.
2012-07-08 12:01:27 +02:00
Antoine Pitrou
bc1a7ddc9b
Check-in compiled importlib changes (you must run "make" after modifying the importlib sources).
2012-07-07 19:49:44 +02:00
Brett Cannon
98979b85e7
Issue #15166 : Re-implement imp.get_tag() using sys.implementation.
...
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.
2012-07-02 15:13:11 -04:00
Antoine Pitrou
0ab5cf9b46
Issue #15181 : importlib bytecode is unsigned and shouldn't have negative numbers.
...
This fixes a compiler warning with suncc.
2012-06-25 17:32:43 +02:00
Eric V. Smith
e51a36922f
Fixes issue 15039: namespace packages are no longer imported in preference to modules of the same name.
2012-06-24 19:13:55 -04:00
Antoine Pitrou
310f95b04d
A better repr() for FileFinder
2012-06-23 02:12:56 +02:00
Antoine Pitrou
e67f48ce5e
Issue #14928 : Fix importlib bootstrap issues by using a custom executable (Modules/_freeze_importlib) to build Python/importlib.h.
2012-06-19 22:29:35 +02:00
Antoine Pitrou
1d25b6f04a
Issue #15103 : remove the NUL character (serving as a Mercurial binary marker) from Python/importlib.h.
...
Instead the email notification hook uses a configuration option to omit importlib.h diffs.
2012-06-19 16:33:39 +02:00
Antoine Pitrou
2d9db1dfce
Try to fix issue #15086 : build failure on Ubuntu shared buildbot.
2012-06-17 00:27:30 +02:00
Brett Cannon
99d776fdf4
Update importlib.h by touching Lib/importlib/_bootstrap.py.
2012-06-11 11:02:53 -04:00
Nick Coghlan
5c6eba3a93
Tweak importlib._bootstrap to avoid zero-argument super so I can work on issue #14857 without breaking imports
2012-05-27 17:49:58 +10:00
Brett Cannon
d785cb3955
Remove some redundant decorators.
2012-05-26 14:28:21 -04:00
Eric V. Smith
984b11f88f
issue 14660: Implement PEP 420, namespace packages.
2012-05-24 20:21:04 -04:00
Antoine Pitrou
ea3eb88bca
Issue #9260 : A finer-grained import lock.
...
Most of the import sequence now uses per-module locks rather than the
global import lock, eliminating well-known issues with threads and imports.
2012-05-17 18:55:59 +02:00
Antoine Pitrou
b84bc7a7ce
Avoid "warning: no newline at end of file" in importlib.h.
2012-05-16 12:58:04 +02:00
Benjamin Peterson
6ecf8ce364
apparently importlib.h wants to be updated
2012-05-14 22:17:34 -07:00
Brett Cannon
c049952de7
Issue #13959 : Have
...
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().
2012-05-11 14:48:41 -04:00
Brett Cannon
44ec91f6a5
Update importlib.h
2012-05-11 13:11:02 -04:00
Antoine Pitrou
6efa50a384
Issue #14583 : Fix importlib bug when a package's __init__.py would first import one of its modules then raise an error.
2012-05-07 21:41:59 +02:00
Brett Cannon
feccc09952
Clean up a docstring.
2012-05-04 16:47:54 -04:00
Brett Cannon
a6685e8d36
update importlib.h
2012-05-04 16:03:20 -04:00
Brett Cannon
2657df4744
Issue #13959 : Re-implement imp.get_suffixes() in Lib/imp.py.
...
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.
2012-05-04 15:20:40 -04:00
Brett Cannon
efad00d520
Issue #14646 : __import__() now sets __loader__ if need be.
...
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.
2012-04-27 17:27:14 -04:00
Brett Cannon
fea73efc9e
Issue #14605 : Don't error out if get_importer() returns None.
2012-04-27 15:45:15 -04:00
Brett Cannon
aa93642a35
Issue #14605 : Use None in sys.path_importer_cache to represent no
...
finder instead of using some (now non-existent) implicit finder.
2012-04-27 15:30:58 -04:00
Brett Cannon
ce418b448f
Issue #14605 : Stop having implicit entries for sys.meta_path.
...
ImportWarning is raised if sys.meta_path is found to be empty.
2012-04-27 14:01:58 -04:00
Brett Cannon
e0d88a173c
Issue #14605 : Make explicit the entries on sys.path_hooks that used to
...
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.
2012-04-25 20:54:04 -04:00
Brett Cannon
f96bb2f9af
Update importlib.h
2012-04-25 20:18:55 -04:00
Marc-Andre Lemburg
7541c8ea37
Issue #14605 and #14642 :
...
Issue a warning in case Python\importlib.h needs to be rebuilt,
but there's no Python interpreter around to freeze the bootstrap
script.
2012-04-25 10:54:48 +02:00
Marc-Andre Lemburg
4fe29c9657
Issue #14605 : Rename _SourcelessFileLoader to SourcelessFileLoader.
...
This time also recreating the Python/importlib.h file to make
make happy. See the ticket for details.
2012-04-25 02:31:37 +02:00