Commit Graph

4152 Commits

Author SHA1 Message Date
Brett Cannon 357c9fb055 Rename importlib.util.ModuleManager to module_to_load so that the name
explains better what the context manager is providing.
2013-05-30 17:31:47 -04:00
Brett Cannon 3dc48d6f69 Issue #18070: importlib.util.module_for_loader() now sets __loader__
and __package__ unconditionally in order to do the right thing for
reloading.
2013-05-28 18:35:54 -04:00
Brett Cannon f5fe13099e Update importlib.h 2013-05-28 17:50:04 -04:00
Brett Cannon a3687f0d68 Introduce importlib.util.ModuleManager which is a context manager to
handle providing (and cleaning up if needed) the module to be loaded.

A future commit will use the context manager in
Lib/importlib/_bootstrap.py and thus why the code is placed there
instead of in Lib/importlib/util.py.
2013-05-28 17:29:34 -04:00
Charles-Francois Natali 74ca886788 Issue #17917: Use PyModule_AddIntMacro() instead of PyModule_AddIntConstant()
when applicable.
2013-05-20 19:13:19 +02:00
Antoine Pitrou fef34e3186 Issue #17937: Try harder to collect cyclic garbage at shutdown. 2013-05-19 01:11:58 +02:00
Richard Oudkerk 25296ce5de Use PY_FORMAT_SIZE_T because Visual Studio does not understand %zd format. 2013-05-18 17:35:19 +01:00
Victor Stinner 84bb1cf994 Fix compilater warnings on Windows 64-bit 2013-05-17 00:12:04 +02:00
Victor Stinner 9ce59bbe43 Fix a compilater warning on Windows 64-bit 2013-05-17 00:04:56 +02:00
Victor Stinner d3dfd0e433 Fix a compilater warning on Windows 64-bit
idx variable is used for a tuple indexn so use Py_ssize_t (not int).
2013-05-16 23:48:01 +02:00
Victor Stinner 0b1bc56bb6 fix compilation on Windows 2013-05-16 22:17:17 +02:00
Benjamin Peterson e8e14591eb rather than passing locals to the class body, just execute the class body in the proper environment 2013-05-16 14:37:25 -05:00
Benjamin Peterson 312595ce3a hide the __class__ closure from the class body (#12370) 2013-05-15 15:26:42 -05:00
Benjamin Peterson 159ae41da6 when an argument is a cell, set the local copy to NULL (see #17927) 2013-05-12 18:16:06 -05:00
Guido van Rossum 6832c81d5d #17927: Keep frame from referencing cell-ified arguments. 2013-05-10 08:47:42 -07:00
Charles-Francois Natali f28dfdd07b Issue #17912: Use a doubly linked-list for thread states. 2013-05-08 21:09:52 +02:00
Antoine Pitrou 070cb3c9be Issue #1545463: At shutdown, defer finalization of codec modules so that stderr remains usable.
(should fix Windows buildbot failures on test_gc)
2013-05-08 13:23:25 +02:00
Victor Stinner 22c103b3cc Fix a compiler warning: use unsigned int type instead of enum PyUnicode_Kind to
compare two Unicode kinds
2013-05-07 23:50:03 +02:00
Victor Stinner 313f10c722 Fix a compiler warning: in and out are unused in _Py_char2wchar() if
HAVE_MBRTOWC is not defined
2013-05-07 23:48:56 +02:00
Antoine Pitrou 5f454a07a0 Issue #1545463: Global variables caught in reference cycles are now garbage-collected at shutdown. 2013-05-06 21:15:57 +02:00
Antoine Pitrou 8408cea0cd Issue #17094: Clear stale thread states after fork().
Note that this is a potentially disruptive change since it may
release some system resources which would otherwise remain
perpetually alive (e.g. database connections kept in thread-local
storage).
2013-05-05 23:47:09 +02:00
Antoine Pitrou 4adb566ad7 Fix crash caused by 8c1385205a35
(thanks Arfrever for reporting).
2013-05-05 08:14:53 +02:00
Antoine Pitrou fd417cc54b Fix crash caused by 8c1385205a35
(thanks Arfrever for reporting).
2013-05-05 08:12:42 +02:00
Brett Cannon 13853a67cf #17115: I hate you MS for not supporting C99. 2013-05-04 17:37:09 -04:00
Antoine Pitrou df6931dbbc Issue #17408: Avoid using an obsolete instance of the copyreg module when the interpreter is shutdown and then started again. 2013-05-04 20:46:19 +02:00
Antoine Pitrou 957a23b088 Issue #17408: Avoid using an obsolete instance of the copyreg module when the interpreter is shutdown and then started again. 2013-05-04 20:45:02 +02:00
Brett Cannon 4c14b5de1c #17115,17116: Have modules initialize the __package__ and __loader__
attributes to None.

The long-term goal is for people to be able to rely on these
attributes existing and checking for None to see if they have been
set. Since import itself sets these attributes when a loader does not
the only instances when the attributes are None are from someone
overloading __import__() and not using a loader or someone creating a
module from scratch.

This patch also unifies module initialization. Before you could have
different attributes with default values depending on how the module
object was created. Now the only way to not get the same default set
of attributes is to circumvent initialization by calling
ModuleType.__new__() directly.
2013-05-04 13:56:58 -04:00
Alexandre Vassalotti 865eaa1b53 Closes #17892: Fix the name of _PyObject_CallMethodObjIdArgs 2013-05-02 10:44:04 -07:00
Benjamin Peterson 3b0431dc60 check local class namespace before reaching for cells (closes #17853) 2013-04-30 09:41:40 -04:00
Benjamin Peterson 0bb83f812f merge 3.3 (#17863) 2013-04-29 10:23:31 -04:00
Benjamin Peterson fe1b22af0a ignore errors when trying to fetch sys.stdin.encoding (closes #17863) 2013-04-29 10:23:08 -04:00
Benjamin Peterson 5c089314ef merge 3.3 2013-04-29 09:08:33 -04:00
Benjamin Peterson 7d110042c5 raise an ImportError (rather than fatal) when __import__ is not found in __builtins__ (closes #17867) 2013-04-29 09:08:14 -04:00
Antoine Pitrou 208ac5cf65 Issue #17832: fix a compilation warning about a function prototype.
Also, make the private function static.
2013-04-24 20:17:53 +02:00
R David Murray f097f175dd Merge #17413: make sure settrace funcs get passed exception instances for 'value'.
Patch by Ingrid Cheung and Brendan McLoughlin.
2013-04-19 12:57:54 -04:00
R David Murray 3583761bcd #17413: make sure settrace funcs get passed exception instances for 'value'.
Patch by Ingrid Cheung and Brendan McLoughlin.
2013-04-19 12:56:57 -04:00
Ezio Melotti 03a0c27569 Merge indentation fix from 3.3. 2013-04-19 07:10:45 +03:00
Ezio Melotti 1b6424fc4b Fix indentation. 2013-04-19 07:10:09 +03:00
Brett Cannon edfd6ae79c Issue #17244: Don't mask exceptions raised during the creation of
bytecode files in py_compile.

Thanks to Arfrever Frehtes Taifersar Arahesis for the bug report.
2013-04-14 12:48:15 -04:00
Benjamin Peterson 214a7d2674 properly lookup the __round__ special method (closes #17722) 2013-04-13 17:19:01 -04:00
Antoine Pitrou e9bbe8b87b Issue #15480: Remove the deprecated and unused TYPE_INT64 code from marshal.
Initial patch by Daniel Riti.
2013-04-13 22:41:09 +02:00
Brett Cannon 100883f0cb Issue #17093,17566,17567: Methods from classes in importlib.abc now raise/return
the default exception/value when called instead of raising/returning
NotimplementedError/NotImplemented (except where appropriate).
This should allow for the ABCs to act as the bottom/end of the MRO with expected
default results.

As part of this work, also make importlib.abc.Loader.module_repr()
optional instead of an abstractmethod.
2013-04-09 16:59:39 -04:00
Serhiy Storchaka ee57f159af Revert a premature patch for issue #14010 (changeset 846bd418aee5). 2013-04-06 22:55:12 +03:00
Serhiy Storchaka 278d03bd66 Revert a premature patch for issue #14010 (changeset aaaf36026511). 2013-04-06 22:52:34 +03:00
Antoine Pitrou 7d8c29a022 Issue #17645: convert an assert() into a proper exception in _Py_Mangle(). 2013-04-06 21:21:46 +02:00
Antoine Pitrou 55bff89190 Issue #17645: convert an assert() into a proper exception in _Py_Mangle(). 2013-04-06 21:21:04 +02:00
Serhiy Storchaka aac81e2780 Issue #14010: Fix a crash when iterating or deleting deeply nested filters
(builting and in itertools module, i.e. map(), itertools.chain(), etc).
2013-04-06 21:20:30 +03:00
Serhiy Storchaka e8f706eda7 Issue #14010: Fix a crash when iterating or deleting deeply nested filters
(builting and in itertools module, i.e. map(), itertools.chain(), etc).
2013-04-06 21:14:43 +03:00
Richard Oudkerk eea1f5c2e4 Merge 2013-04-03 13:49:36 +01:00
Richard Oudkerk 614c578dec Issue #17619: Make input() check for Ctrl-C correctly on Windows. 2013-04-03 13:44:50 +01:00