Nick Coghlan
0b43bcf528
Close #14857 : fix regression in references to PEP 3135 implicit __class__ closure variable. Reopens issue #12370 , but also updates unittest.mock to workaround that issue
14 years ago
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.
14 years ago
Antoine Pitrou
d576c711a5
Issue #14761 : Fix potential leak on an error case in the import machinery.
14 years ago
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.
14 years ago
Antoine Pitrou
b78174c010
Fix too early decrefs.
14 years ago
Nadeem Vawda
8f46d655b9
Fix typo in changeset eb5c5c23ca9b.
14 years ago
Antoine Pitrou
f3a42dee9a
Simplify code for load_dynamic()
14 years ago
Brett Cannon
0429e1a57d
Issue #13959 : Move module type constants to Lib/imp.py.
14 years ago
Brett Cannon
6b9b727695
Remove dead Windows code which no longer will compile.
14 years ago
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.
14 years ago
Brett Cannon
62228dbd6c
Issues #13959 , 14647: Re-implement imp.reload() in Lib/imp.py.
Thanks to Eric Snow for the patch.
14 years ago
Brett Cannon
acf85cd131
Issue #13959 : Re-implement imp.NullImporter in Lib/imp.py.
14 years ago
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.
14 years ago
Victor Stinner
8f825060f1
Check newly created consistency using _PyUnicode_CheckConsistency(str, 1)
* In debug mode, fill the string data with invalid characters
* Simplify also reference counting in PyCodec_BackslashReplaceErrors()
and PyCodec_XMLCharRefReplaceError()
14 years ago
Brett Cannon
8923a4d4c5
Issue #14605 : Insert to the front of sys.path_hooks instead of appending.
14 years ago
Brett Cannon
e69f0df45b
Issue #13959 : Re-implement imp.find_module() in Lib/imp.py.
Thanks to Eric Snow for taking an initial stab at the implementation.
14 years ago
Brett Cannon
a64faf0771
Issue #13959 : Re-implement imp.source_from_cache() in Lib/imp.py.
14 years ago
Brett Cannon
ea59dbff16
Issue #13959 : Re-implement imp.cache_from_source() in Lib/imp.py.
14 years ago
Benjamin Peterson
d76bc7abac
rollback 005fd1fe31ab (see #14609 and #14582 )
Being able to overload a sys.module entry during import of a module was broken
by this changeset.
14 years ago
Brett Cannon
64befe939c
Issue #13959 : Re-implement imp.load_compiled() in imp.py.
14 years ago
Brett Cannon
273323cf68
Issue #14592 : A relative import will raise a KeyError if __package__
or __name__ are not set in globals.
Thanks to Stefan Behnel for the bug report.
14 years ago
Brian Curtin
09b86d1196
Fix #14600 . Correct reference handling and naming of ImportError convenience function
14 years ago
Brett Cannon
16475adcbb
Issue #13959 : Re-implement imp.load_source() in imp.py.
14 years ago
Antoine Pitrou
22a1d17bb5
Fix another refleak
14 years ago
Antoine Pitrou
538ba2afb5
Fix a refleak
14 years ago
Antoine Pitrou
71382cb64b
Fix reference loss on Py_None when None is encountered in sys.modules.
14 years ago
Brett Cannon
2ee61422ed
Issue #13959 : Re-implement imp.load_package() in imp.py.
Thanks to Eric Snow for helping with imp.load_module() (previous
commit) which led to the removal of a bunch of C code.
14 years ago
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
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
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
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
6c40eb7f42
Fix the builtin module initialization code to store the init function for future reinitialization.
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