Commit Graph

359 Commits

Author SHA1 Message Date
Andrew Svetlov f7a17b48d7 Replace IOError with OSError (#16715) 2012-12-25 16:47:37 +02:00
Andrew Svetlov 2606a6f197 Issue #16719: Get rid of WindowsError. Use OSError instead
Patch by Serhiy Storchaka.
2012-12-19 14:33:35 +02:00
Eric Snow a6cfb28bd2 Issue #15627: This is simply an update to the name of a new method recently added
to importlib.abc.SourceLoader.
2012-12-04 23:43:43 -08:00
Barry Warsaw b72c10996e - Issue #16514: Fix regression causing a traceback when sys.path[0] is None
(actually, any non-string or non-bytes type).
2012-11-20 15:35:27 -05:00
Barry Warsaw 82c1c781c7 - Issue #16514: Fix regression causing a traceback when sys.path[0] is None
(actually, any non-string or non-bytes type).
2012-11-20 15:22:51 -05:00
Brett Cannon 5650e4f41c Issue #15627: Add the compile_source() method to
importlib.abc.SourceLoader.

This provides an easy hook into the import system to allow for source
transformations, AST optimizations, etc.
2012-11-18 10:03:31 -05:00
Brett Cannon 10f19812b5 Merge fix for #16489 from 3.3 2012-11-17 09:33:14 -05:00
Brett Cannon 56b4ca78d8 Issue #16489: Make it clearer that importlib.find_loader() requires
the user to import any parent packages.
2012-11-17 09:30:55 -05:00
Benjamin Peterson 29824550b1 merge 3.3 2012-11-12 16:48:25 -05:00
Benjamin Peterson debf64ce2b missing letter 2012-11-12 16:48:17 -05:00
Andrew Svetlov 90a654b1dd Issue #15641: Clean up deprecated classes from importlib
Patch by Taras Lyapun.
2012-11-05 09:34:46 +02:00
Nick Coghlan d4f5ad6c6e Merge fix from #6074 from 3.3 2012-10-19 23:36:15 +10:00
Nick Coghlan eb8d627bbd Issue #6074: Apply an appropriate fix for importlib based imports 2012-10-19 23:32:00 +10:00
Trent Nelson 744faddae8 Merge issue #15833: don't raise an exception if importlib can't write
byte-compiled files.

This fixes a regression introduced by 3.3.

Patch by Charles-François Natali.
2012-10-16 08:03:21 -04:00
Trent Nelson d783c8ed00 Issue #15833: don't raise an exception if importlib can't write byte-compiled
files.

This fixes a regression introduced by 3.3.  Patch by Charles-François Natali.
2012-10-16 07:47:34 -04:00
Brett Cannon 6072e0bf42 Remove uses of % with str.format. 2012-10-12 10:00:34 -04:00
Brett Cannon 9407d50208 Merge fix for issue #15111. 2012-10-10 19:18:37 -04:00
Brett Cannon a6ce4fd426 Closes issue #15111: Calling __import__ with a module specified in
fromlist which causes its own ImportError (e.g. the module tries to
import a non-existent module) should have that exception propagate.
2012-10-10 19:03:46 -04:00
Jesus Cea 4791a24268 #16135: Removal of OS/2 support (Python code partial cleanup) 2012-10-05 03:15:39 +02:00
Brett Cannon 8ed677db12 Add some comments. 2012-09-28 16:41:39 -04:00
Benjamin Peterson 52c62d8697 rephrase 2012-09-26 00:25:10 -04:00
Benjamin Peterson feaa54f537 don't depend on __debug__ because it's baked in at freeze time (issue #16046) 2012-09-25 11:22:59 -04:00
Antoine Pitrou 4f0338cab7 Issue #15781: Fix two small race conditions in import's module locking. 2012-08-28 00:24:52 +02:00
Brett Cannon 12c6bda4f0 Issue #15316: Let exceptions raised during imports triggered by the
fromlist of __import__ propagate.

The problem previously was that if something listed in fromlist didn't
exist then that's okay. The fix for that was too broad in terms of
catching ImportError.

The trick with the solution to this issue is that the proper
refactoring of import thanks to importlib doesn't allow for a way to
distinguish (portably) between an ImportError because finders couldn't
find a loader, or a loader raised the exception. In Python 3.4 the
hope is to introduce a new exception (e.g. ModuleNotFound) to make it
clean to differentiate why ImportError was raised.
2012-08-24 18:25:59 -04:00
Brett Cannon ba0a3edd26 Issue #2051: Tweak last commit for this issue to pass in mode instead
of source path to set_data() and make the new argument private until
possible API changes can be discussed more thoroughly in Python 3.4.
2012-08-24 13:48:39 -04:00
Nick Coghlan a508770e20 Close #2501: Permission bits are once again correctly copied from the source file to the cached bytecode file. Test by Eric Snow. 2012-08-24 18:32:40 +10:00
Nick Coghlan 48fec05391 Close #14846: Handle a sys.path entry going away 2012-08-20 13:18:15 +10:00
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 8a9080feff Issue #15502: Bring the importlib ABCs into line with the current state of the import protocols given PEP 420. Original patch by Eric Snow. 2012-08-02 21:26:03 +10:00
Barry Warsaw 38f75cbc00 Typo. 2012-07-31 16:39:43 -04:00
Barry Warsaw 9a5af1288d merge 2012-07-31 16:03:25 -04: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
Barry Warsaw dee609c09f merged 2012-07-29 16:40:04 -04:00
Barry Warsaw d7d2194ea1 Integration of importdocs from the features/pep-420 repo. 2012-07-29 16:36:17 -04: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
Brett Cannon 45a5e3afe5 Issue #15168: Move importlb.test to test.test_importlib.
This should make the Linux distros happy as it is now easier to leave
importlib's tests out of their base Python distribution.
2012-07-20 14:48:53 -04:00
Nick Coghlan be7e49fd82 Close #15386: There was a loophole that meant importlib.machinery and imp would sometimes reference an uninitialised copy of importlib._bootstrap 2012-07-20 23:40:09 +10:00
Nick Coghlan 76e077001d Close #15387: inspect.getmodulename() now uses a new importlib.machinery.all_suffixes() API rather than the deprecated inspect.getmoduleinfo() 2012-07-18 23:14:57 +10: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