Commit Graph

54925 Commits

Author SHA1 Message Date
Victor Stinner 0db176f8f6 Issue #14386: Expose the dict_proxy internal type as types.MappingProxyType 2012-04-16 00:16:30 +02: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 7ceedb8c1e Update importlib.h 2012-04-15 17:47:19 -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 7788838473 merge 2012-04-15 15:25:10 -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
Philip Jenvey f8f3190d32 utilize startswith(tuple) 2012-04-15 12:21:32 -07: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
Mark Dickinson da4210f77d Issue #13496: Merge from 3.2 2012-04-15 16:32:04 +01:00
Mark Dickinson a13b109bc0 Issue 13496: Fix bisect.bisect overflow bug for large collections. 2012-04-15 16:30:35 +01:00
Mark Dickinson b0f00476a0 Issue #13889: Merge fix from 3.2. 2012-04-15 15:12:37 +01:00
Mark Dickinson 18e3d81f96 Issue #13889: On MSVC builds, set FPU control word at runtime for all string <-> float conversions. Patch by Samuel Iseli and Stefan Krah. 2012-04-15 15:10:56 +01:00
Kristján Valur Jónsson 69c635266e Issue #10576: Add a progress callback to gcmodule 2012-04-15 11:41:32 +00:00
Kristján Valur Jónsson c014df7edf Merge with 3.2: use ws2_32.lib rather than wsock32.lib on windows. 2012-04-15 11:14:46 +00:00
Kristján Valur Jónsson 473fde60dc Make all socket related modules link with ws2_32.lib on windows, like
_socket does.  Some were using the older wsock32.lib.
2012-04-15 11:12:57 +00:00
Ross Lagerwall acb2b0dc67 Merge with remote. 2012-04-15 08:23:09 +02:00
Ross Lagerwall 0b63b5691c Be less verbose when building dbm. 2012-04-15 08:19:35 +02:00
Brett Cannon fc9ca274b8 Plug a refleak. 2012-04-15 01:35:05 -04:00
Brett Cannon 2a082add9d Clarify that one should not use __import__() directly. Also mention
PEP 328 in explaining how 'index' works.
2012-04-14 21:58:33 -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
Brett Cannon 59f9c3affc Rebuild importlib.h to incorporate added comments. 2012-04-14 21:18:48 -04:00
Brett Cannon aef82d3d1e IDLE was relying on implicit relative imports which have gone away in
Python 3.3 thanks to importlib finishing the work in PEP 328 that
accidently got carried forward.
2012-04-14 20:44:23 -04:00
Brett Cannon 44590e4786 Add some comments. 2012-04-14 18:37:07 -04:00
Brian Curtin 2217c46a5f merge with the tip 2012-04-14 14:20:29 -05:00
Brian Curtin e6b299faf5 Fix Windows build 2012-04-14 14:19:33 -05:00
Brett Cannon afbdc13c1b Fix an import race condition. 2012-04-14 15:06:17 -04:00
Brett Cannon 73def61edd Try to fix a sporadic test failure from what is probably a caching race condition. 2012-04-14 14:38:19 -04: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
Sandro Tosi d2cbd90539 merge with 3.2 2012-04-14 16:01:49 +02:00
Sandro Tosi 1ee17198c8 fix typo; thanks to Jérôme Mainka from docs@ 2012-04-14 16:01:17 +02:00
Ezio Melotti 9c9af9d2ad Merge highlight and spacing fixes in json example with 3.2. 2012-04-13 21:05:36 -06:00
Ezio Melotti 84e59aa989 Fix highlight and spacing in json example. 2012-04-13 21:02:18 -06:00
Ezio Melotti 584fbbb32d #14535: merge with 3.2. 2012-04-13 20:52:29 -06:00
Ezio Melotti f86b28e3d2 #14535: fix code highlight in multiprocessing examples. Patch by Tshepang Lekhonkhobe. 2012-04-13 20:50:48 -06:00
R David Murray 2c4efa871e Merge #14399: corrected news item 2012-04-13 21:27:19 -04:00
R David Murray 650dfaf5c4 #14399: corrected news item 2012-04-13 21:24:27 -04:00
Benjamin Peterson 780b66b3e6 merge 3.2 2012-04-13 18:06:42 -04:00
Benjamin Peterson 3bf01757b6 move outside WITH_THREAD conditional 2012-04-13 18:06:36 -04:00
Victor Stinner b8d016955a Fix clock_gettime/getres/settime: PyArg_ParseTuple() expects an int
Only use a single #ifdef for the 3 functions.
2012-04-13 23:44:05 +02:00
Michael Foord 0682a0c0a9 Minor docstring / docs corrections for unittest.mock 2012-04-13 20:51:20 +01:00
Michael Foord 656319e58d Make unittest.mock.create_autospec resilient against AttributeError on original object 2012-04-13 17:39:16 +01:00
Benjamin Peterson 899ee613f7 merge 3.2 2012-04-13 11:59:52 -04:00
Benjamin Peterson 43162b8a02 take linkage def outside of WITH_THREAD conditional (closes #14569) 2012-04-13 11:58:27 -04:00
Michael Foord c287062fcf unittest.mock.PropertyMock return value and attributes are now standard MagicMocks 2012-04-13 16:57:22 +01:00
Benjamin Peterson 633b32a7fa put PyImportErrorObject with its brothers 2012-04-12 21:50:35 -04:00
Brett Cannon 15af26fa92 Merge 2012-04-12 21:13:08 -04:00
Brett Cannon a29629f632 NEWS entry about importlib and ImportError's new attributes. 2012-04-12 21:12:37 -04:00
Brett Cannon bbb6680ee5 Have importlib take advantage of ImportError's new 'name' and 'path'
attributes.
2012-04-12 21:09:01 -04:00
Amaury Forgeot d'Arc b413874bc8 merge heads 2012-04-13 02:29:54 +02:00