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
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
Antoine Pitrou
b78174c010
Fix too early decrefs.
2012-05-06 17:15:23 +02:00
Nadeem Vawda
8f46d655b9
Fix typo in changeset eb5c5c23ca9b.
2012-05-05 12:27:30 +02:00
Antoine Pitrou
f3a42dee9a
Simplify code for load_dynamic()
2012-05-04 22:40:25 +02:00
Brett Cannon
0429e1a57d
Issue #13959 : Move module type constants to Lib/imp.py.
2012-05-04 16:13:30 -04:00
Brett Cannon
6b9b727695
Remove dead Windows code which no longer will compile.
2012-05-04 16:04:14 -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
62228dbd6c
Issues #13959 , 14647: Re-implement imp.reload() in Lib/imp.py.
...
Thanks to Eric Snow for the patch.
2012-04-29 14:38:11 -04:00
Brett Cannon
acf85cd131
Issue #13959 : Re-implement imp.NullImporter in Lib/imp.py.
2012-04-29 12:50:03 -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
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()
2012-04-27 13:55:39 +02:00
Brett Cannon
8923a4d4c5
Issue #14605 : Insert to the front of sys.path_hooks instead of appending.
2012-04-24 22:03:46 -04:00
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.
2012-04-21 21:09:46 -04:00
Brett Cannon
a64faf0771
Issue #13959 : Re-implement imp.source_from_cache() in Lib/imp.py.
2012-04-21 18:52:52 -04:00
Brett Cannon
ea59dbff16
Issue #13959 : Re-implement imp.cache_from_source() in Lib/imp.py.
2012-04-20 21:44:46 -04:00
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.
2012-04-18 10:55:43 -04:00
Brett Cannon
64befe939c
Issue #13959 : Re-implement imp.load_compiled() in imp.py.
2012-04-17 19:14:26 -04:00
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.
2012-04-17 19:05:11 -04:00
Brian Curtin
09b86d1196
Fix #14600 . Correct reference handling and naming of ImportError convenience function
2012-04-17 16:57:09 -05:00
Brett Cannon
16475adcbb
Issue #13959 : Re-implement imp.load_source() in imp.py.
2012-04-16 22:11:25 -04:00
Antoine Pitrou
22a1d17bb5
Fix another refleak
2012-04-16 22:06:21 +02:00
Antoine Pitrou
538ba2afb5
Fix a refleak
2012-04-16 21:52:45 +02:00
Antoine Pitrou
71382cb64b
Fix reference loss on Py_None when None is encountered in sys.modules.
2012-04-16 18:48:49 +02:00
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.
2012-04-15 22:28:28 -04:00
Brett Cannon
01a76171a0
Issue #13959 : Re-implement imp.load_module() in imp.py.
2012-04-15 20:25:23 -04:00
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.
2012-04-15 17:56:09 -04:00
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.
2012-04-15 16:08:47 -04:00
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.
2012-04-15 15:24:04 -04:00
Brett Cannon
27fc52877c
Set ImportError.name when raising the exception in the case of None
...
found in sys.modules.
2012-04-15 14:15:31 -04:00
Brett Cannon
49f8d8b016
Handle importing pkg.mod by executing
...
__import__('mod', {'__packaging__': 'pkg', level=1) w/o properly (and
thus not segfaulting).
2012-04-14 21:50:00 -04:00
Brian Curtin
e6b299faf5
Fix Windows build
2012-04-14 14:19:33 -05:00
Brett Cannon
740fce0e38
Undo a C99 idiom.
2012-04-14 14:23:49 -04:00
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__().
2012-04-14 14:10:13 -04:00
Benjamin Peterson
f53d20f2cd
in 72556ff86828, I should have updated the magic as well as the comment ( #14230 )
2012-03-16 09:39:12 -05:00
Benjamin Peterson
abdb5528c0
fix comment
2012-03-15 15:40:37 -05:00
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.
2012-03-15 15:37:39 -05:00
Antoine Pitrou
cf1c8339f9
Issue #14084 : Fix a file descriptor leak when importing a module with a bad encoding.
2012-02-22 18:08:30 +01:00
Antoine Pitrou
4f22a8d739
Issue #14084 : Fix a file descriptor leak when importing a module with a bad encoding.
2012-02-22 18:05:43 +01:00
Antoine Pitrou
7214612443
In find_module(), do not silence fileno() and dup() errors.
2012-02-22 18:03:04 +01:00
Victor Stinner
a3dd409b52
Remove now useless arbitrary limit of module name length
2012-01-26 00:31:49 +01: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
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
Antoine Pitrou
165e01f83f
Fix the builtin module initialization code to store the init function for future reinitialization.
2012-01-18 20:17:58 +01:00
Antoine Pitrou
6c40eb7f42
Fix the builtin module initialization code to store the init function for future reinitialization.
2012-01-18 20:16:09 +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
Victor Stinner
3573476271
(Merge 3.2) Handle correctly _Py_fopen() error: don't replace the exception
2011-12-18 21:05:22 +01:00
Victor Stinner
bd0850b857
import.c now catchs _Py_stat() exceptions
...
_Py_stat() now returns -2 if an exception was raised.
2011-12-18 20:47:30 +01:00