Brett Cannon
01a76171a0
Issue #13959 : Re-implement imp.load_module() in imp.py.
14 years ago
Brett Cannon
8a1d04c643
Issue #13959 : Simplify imp.reload() by relying on a module's
__loader__.
Since import now sets __loader__ on all modules it creates and
imp.reload() already relied on the attribute for modules that import
didn't create, the only potential compatibility issue is if people
were deleting the attribute on modules and expecting imp.reload() to
continue to work.
14 years ago
Brett Cannon
6f44d66bc4
Issue #13959 : Rename imp to _imp and add Lib/imp.py and begin
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.
14 years ago
Brett Cannon
881535b726
Issue #14582 : Import returns the module returned by a loader instead
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.
14 years ago
Brett Cannon
27fc52877c
Set ImportError.name when raising the exception in the case of None
found in sys.modules.
14 years ago
Brett Cannon
49f8d8b016
Handle importing pkg.mod by executing
__import__('mod', {'__packaging__': 'pkg', level=1) w/o properly (and
thus not segfaulting).
14 years ago
Brian Curtin
e6b299faf5
Fix Windows build
14 years ago
Brett Cannon
740fce0e38
Undo a C99 idiom.
14 years ago
Brett Cannon
fd0741555b
Issue #2377 : Make importlib the implementation of __import__().
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__().
14 years ago
Gregory P. Smith
fcdf04becc
Fixes Issue #14331 : Use significantly less stack space when importing modules by
allocating path buffers on the heap instead of the stack.
14 years ago
Gregory P. Smith
c809f98143
Fixes Issue #14331 : Use significantly less stack space when importing modules by
allocating path buffers on the heap instead of the stack.
14 years ago
Benjamin Peterson
f53d20f2cd
in 72556ff86828, I should have updated the magic as well as the comment ( #14230 )
14 years ago
Benjamin Peterson
abdb5528c0
fix comment
14 years ago
Benjamin Peterson
2afe6aeae8
perform yield from delegation by repeating YIELD_FROM opcode ( closes #14230 )
This allows generators that are using yield from to be seen by debuggers. It
also kills the f_yieldfrom field on frame objects.
Patch mostly from Mark Shannon with a few tweaks by me.
14 years ago
Jason R. Coombs
0e17dfbdcf
Test in 6c218b9c5c4c was inadvertently converted from #ifdef to #if. Now #ifdef again.
14 years ago
Antoine Pitrou
4f22a8d739
Issue #14084 : Fix a file descriptor leak when importing a module with a bad encoding.
14 years ago
Antoine Pitrou
7214612443
In find_module(), do not silence fileno() and dup() errors.
14 years ago
Victor Stinner
a3dd409b52
Remove now useless arbitrary limit of module name length
14 years ago
Antoine Pitrou
33d15f7c85
Port import fixes from 2.7.
14 years ago
Antoine Pitrou
6f25d75f25
Remove debug output, fix assert (hopefully) and exercise signedness issues a bit more.
14 years ago
Antoine Pitrou
b744cef654
Fix temporary debug output (so, time_t is 8 bytes on some Windows builds)
14 years ago
Antoine Pitrou
11cc480ed0
Temporary debug for Windows buildbots.
14 years ago
Antoine Pitrou
0e5fd59a27
Make guard more dynamic (apparently the size of a filesystem timestamp may vary under Windows).
14 years ago
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.
14 years ago
Antoine Pitrou
d1c818a9c0
Issue #11235 : Fix OverflowError when trying to import a source file whose modification time doesn't fit in a 32-bit timestamp.
14 years ago
Antoine Pitrou
6c40eb7f42
Fix the builtin module initialization code to store the init function for future reinitialization.
14 years ago
Jason R. Coombs
0737b7281e
Fix indentation
14 years ago
Jason R. Coombs
fa93cf8e3e
Extracted Windows directory detection from NullImporter.__init__. This greatly simplifies the code and fixes issue6727.
14 years ago
Jason R. Coombs
925ff7495b
Moved directory detection into an isdir function
14 years ago
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.
14 years ago
Victor Stinner
bd0850b857
import.c now catchs _Py_stat() exceptions
_Py_stat() now returns -2 if an exception was raised.
14 years ago
Charles-François Natali
1659b83b1d
Followup to a541bda2f5e2: Add a short comment.
14 years ago
Charles-François Natali
7c0b0cc9f9
Issue #11051 : Reduce the number of syscalls per import.
14 years ago
Antoine Pitrou
86a36b500a
PEP 3155 / issue #13448 : Qualified name for classes and functions.
14 years ago
Victor Stinner
1f7951711c
Catch PyUnicode_AS_UNICODE() errors
14 years ago
Antoine Pitrou
8ad982cccf
Use PyUnicode_FromFormat() to create the temporary file name.
Also, as in importlib, append the id of an object to make the file name
pseudo-random.
14 years ago
Antoine Pitrou
1d8f3f451c
Fix regression under Windows following b75b41237380 (from issue #13392 )
14 years ago
Antoine Pitrou
28e401e717
Issue #13392 : Writing a pyc file should now be atomic under Windows as well.
14 years ago
Charles-François Natali
0c929d9d39
Issue #13303 : Fix bytecode file default permission.
14 years ago
Éric Araujo
5df1108de2
Add signatures to the docstring of functions added to imp by PEP 3147
14 years ago
Antoine Pitrou
8db076cf8a
Issue #10363 : Deallocate global locks in Py_Finalize().
14 years ago
Charles-François Natali
e695eec24a
Issue #13303 : Fix a race condition in the bytecode file creation.
14 years ago
Martin v. Löwis
f45dee998f
Port import_module_level to Unicode API.
14 years ago
Martin v. Löwis
796ea53937
Port PyImport_ReloadModule to Unicode API.
14 years ago
Antoine Pitrou
b528fcf954
Fix test_imp failure under Windows
14 years ago
Martin v. Löwis
9af29d39af
Rewrite find_module_path using unicode API.
14 years ago
Martin v. Löwis
2cc0cc54a2
Fix off-by-one error.
14 years ago
Martin v. Löwis
fadcd317fa
Drop unused macros. Use CACHEDIR consistently.
14 years ago
Martin v. Löwis
8a0ef78e8c
Rewrite make_source_pathname using Unicode API.
14 years ago
Martin v. Löwis
30260a7fe3
Add ready checks for make_compiled_pathname.
14 years ago