Commit Graph

220 Commits

Author SHA1 Message Date
Brett Cannon 7fab676e87 Refactor importlib.__import__() and _gcd_import() to facilitate using
an __import__ implementation that takes care of basics in C and punts
to importlib for more complicated code.
2012-02-16 13:43:41 -05:00
Brett Cannon 0568d6fd4e Bring importlib in line w/ changes made in my personal bootstrap branch in the sandbox. 2012-02-14 18:38:11 -05:00
Philip Jenvey 353c10772a simplify 2012-02-10 11:45:03 -08:00
Brett Cannon 4a2e1a0da7 Undo a bad mq management thingy. 2012-02-08 19:11:53 -05:00
Brett Cannon 97771096ab Whitespace normalization. 2012-02-08 18:55:37 -05:00
Brett Cannon b4e63b3177 Use the cwd when the empty string is found in sys.path. This leads to
__file__ being an absolute path when the module is found in the
current directory.
2012-02-08 18:52:56 -05:00
Brett Cannon 354c26ecd6 Move setup code from importlib.__init__ to
importlib._bootstrap._setup().
2012-02-08 18:50:22 -05:00
Brett Cannon 8490fab4ad Don't fail in the face of a lacking attribute when wrapping a
function.
2012-02-08 18:44:14 -05:00
Brett Cannon cae1068e82 Re-order importlib benchmarks to be consistent. Also print out what implementation of __import__ is used. 2012-02-07 09:40:33 -05:00
Brett Cannon 466e6a90f2 Have importlib.test.benchmark test with tabnanny as a medium-sized test. 2012-02-07 09:19:12 -05:00
Brett Cannon 5ea5b67a0b Fix a minor output typo as found by Terry Reedy. 2012-01-31 17:02:10 -05:00
Brett Cannon e3a9ae5ece Let importlib.test.benchmark take a specific benchmark name to run. 2012-01-30 19:27:51 -05:00
Brett Cannon 190f33cd2b Allow for the specification of a file to dump importlib benchmark
results to (and to compare against previous runs).
* * *
Move importlib.test.benchmark to argparse.
2012-01-30 19:12:29 -05:00
Brett Cannon 8a8945085f Issue #13890: Also fix for extension module tests for case-insensitivity. 2012-01-30 12:51:49 -05:00
Brett Cannon 01ad3251ae Issue #13890: Fix importlib case-sensitivity tests to not run on Windows.
Thanks to os.environ under Windows only updating the dict and not the
environment itself (as exposed by nt.environ), tests using
PYTHONCASEOK always fail. Now the tests are skipped when os.environ
does not do what is expected.
2012-01-30 12:48:16 -05:00
Brett Cannon 51d14f8e56 Relocate importlib._case_ok to importlib._bootstrap.
This required updating the code to use posix instead of os. This is
all being done to make bootstrapping easier to removing dependencies
that are kept in importlib.__init__ and thus outside of the single
file to bootstrap from.
2012-01-26 19:03:52 -05:00
Brett Cannon c264e3ee20 Move some code from importlib.__init__ to importlib._bootstrap that
does not need to be exposed from C code for bootstrapping reasons.
2012-01-25 18:58:03 -05:00
Antoine Pitrou 581616624d Port import fixes from 2.7. 2012-01-25 18:06:07 +01:00
Antoine Pitrou 33d15f7c85 Port import fixes from 2.7. 2012-01-25 18:01:45 +01:00
Antoine Pitrou 157c1263a2 Port remaining test fixes, and fix test_importlib too. 2012-01-25 03:01:34 +01:00
Antoine Pitrou dd21f68963 Port remaining test fixes, and fix test_importlib too. 2012-01-25 03:00:57 +01:00
Antoine Pitrou abaf89b2be Issue #11235: Fix OverflowError when trying to import a source file whose modification time doesn't fit in a 32-bit timestamp. 2012-01-24 17:45:50 +01:00
Antoine Pitrou 2be60afb7e Issue #11235: Fix OverflowError when trying to import a source file whose modification time doesn't fit in a 32-bit timestamp. 2012-01-24 17:44:06 +01:00
Brett Cannon f522aea7a1 Issue #13588: Rename decorators in importlib.
More descriptive names are now used in order to make tracebacks
more readable.
2012-01-16 11:46:22 -05:00
Benjamin Peterson 6f5b6d7e8f kill useless import added by 87331661042b 2012-01-15 22:43:10 -05:00
Antoine Pitrou 7c9907e565 Fix no-op tests in importlib. 2011-12-30 21:25:15 +01:00
Antoine Pitrou 5136ac0ca2 Issue #13645: pyc files now contain the size of the corresponding source
code, to avoid timestamp collisions (especially on filesystems with a low
timestamp resolution) when checking for freshness of the bytecode.
2012-01-13 18:52:16 +01:00
Antoine Pitrou 5e8767c764 Fix no-op tests in importlib. 2011-12-30 21:26:08 +01:00
Meador Inge 96ff0840b6 Issue #13593: updating the importlib utility decorators for __qualname__. 2011-12-14 22:53:13 -06:00
Meador Inge d7afeeeb8d Issue #13591: import_module potentially imports a module twice. 2011-12-14 22:27:28 -06:00
Meador Inge 416f12ddb3 Issue #13591: import_module potentially imports a module twice. 2011-12-14 22:23:46 -06:00
Florent Xicluna 67317750af Issue #13248: turn 3.2's PendingDeprecationWarning into 3.3's DeprecationWarning (cgi, importlib, nntplib, smtpd). 2011-12-10 11:07:42 +01:00
Antoine Pitrou 28e401e717 Issue #13392: Writing a pyc file should now be atomic under Windows as well. 2011-11-15 19:15:19 +01:00
Charles-François Natali 0c929d9d39 Issue #13303: Fix bytecode file default permission. 2011-11-10 19:12:29 +01:00
Charles-François Natali e695eec24a Issue #13303: Fix a race condition in the bytecode file creation. 2011-10-31 20:47:31 +01:00
Florent Xicluna 68f71a34f4 Simplify and remove few dependencies on 'errno', thanks to PEP 3151. 2011-10-28 16:06:23 +02:00
Antoine Pitrou daaaec9ee7 Silence the FileExistsError which can be raised because of the O_EXCL flag
(as in import.c)
2011-10-19 23:28:40 +02:00
Antoine Pitrou 707033a694 Issue #13146: Writing a pyc file is now atomic under POSIX. 2011-10-17 19:28:44 +02:00
Vinay Sajip 65897a386e Closes #12291 for 3.3 - merged fix from 3.2. 2011-07-02 17:16:02 +01:00
Vinay Sajip 5bdae3bb7c Closes #12291: Fixed bug which was found when doing multiple loads from one stream. 2011-07-02 16:42:47 +01:00
Éric Araujo ef3062f7af Kill dead code in importlib.test.__main__ (#12019, reviewed by Brett Cannon) 2011-06-07 17:58:50 +02:00
Victor Stinner 82f46144cc (Merge 3.2) Issue #11614: Fix importlib tests for the new __hello__ module 2011-05-16 17:00:41 +02:00
Victor Stinner 45323a890a (Merge 3.1) Issue #11614: Fix importlib tests for the new __hello__ module 2011-05-16 16:59:49 +02:00
Victor Stinner 272e24356e Issue #11614: Fix importlib tests for the new __hello__ module 2011-05-16 16:57:18 +02:00
Brett Cannon 5d43cff623 Remove a stale comment. 2011-03-23 18:12:24 -07:00
Brett Cannon 442c9b92d8 Make importlib compatible with __import__ by "fixing" code.co_filename
paths.

__import__ does a little trick when importing from bytecode by
back-patching the co_filename paths to point to the file location
where the code object was loaded from, *not* where the code object was
originally created. This allows co_filename to point to a valid path.
Problem is that co_filename is immutable from Python, so a private
function -- imp._fix_co_filename() -- had to be introduced in order to
get things working properly. Originally the plan was to add a file
argument to marshal.loads(), but that failed as the algorithm used by
__import__ is not fully recursive as one might expect, so to be fully
backwards-compatible the code used by __import__ needed to be exposed.

This closes issue #6811 by taking a different approach than outlined
in the issue.
2011-03-23 16:14:42 -07:00
Brett Cannon a7468bc5c6 Have importlib use the repr of a module name in error messages.
This makes it obvious that an import failed because of some extraneous
whitespace (e.g., a newline).

This is a partial fix for issue #8754.
2011-03-23 16:06:00 -07:00
Ezio Melotti 4969f709cc #11515: Merge with 3.1. 2011-03-15 05:59:46 +02:00
Ezio Melotti 42da663e6f #11515: fix several typos. Patch by Piotr Kasprzyk. 2011-03-15 05:18:48 +02:00
Ezio Melotti 373089239b #11515: Merge with 3.2. 2011-03-15 06:03:08 +02:00