Commit Graph

79862 Commits

Author SHA1 Message Date
Brett Cannon a79e4fb38d Issue #18342: Use the repr of a module name for ``from ... import
...`` when an ImportError occurs.

Other cases had already been switched over to using the repr.

Thanks to Tomasz Maćkowiak for the patch.
2013-07-12 11:22:26 -04:00
Brett Cannon f0cb69274c Issue #18415: Normalize what type of quotes are used with string
constants in importlib._bootstrap. Along the way clean up from string
interpolation to use the repr explicitly.

Initial patch by Madison May.
2013-07-12 11:04:23 -04:00
Victor Stinner d917dcbe5e Issue #18408: Fix constructors of _elementtree.c
* Use Py_DECREF() instead of PyObject_GC_Del() to release correctly all
  resources
* Raise MemoryError on memory allocation failure
2013-07-12 02:05:17 +02:00
Victor Stinner 81aac734e1 Issue #18408: Fix create_extra() of _elementtree.c, raise MemoryError on memory
allocation failure
2013-07-12 02:03:34 +02:00
Victor Stinner df4572cc71 Issue #18408: parser module: fix error handling in node2tuple()
Handle PyLong_FromLong() and PyUnicode_FromString() failures
2013-07-12 01:35:10 +02:00
Victor Stinner 3bd6abd129 Issue #18408: Fix parser.sequence2st() and parser.tuple2st(): raise MemoryError
on memory allocation failure

Instead of ignoring the memory allocation failure and create invalid objects.
2013-07-12 01:33:59 +02:00
Victor Stinner 4202456cd4 Issue #18408: _pickle.c: Add missing PyErr_NoMemory() on memory allocation failures 2013-07-12 00:53:57 +02:00
Victor Stinner 8ca72e2e3d Issue #18408: _PyMemoTable_ResizeTable() now restores the old table if
allocating a bigger table failed

PyMemoTable destructor does crash if mt_table is NULL.
2013-07-12 00:53:26 +02:00
Victor Stinner a41f085144 Issue #18408: pmerge() help of mro_implementation() now raises MemoryError on
memory allocation failure

Replace also PyMem_Free() with PyMem_FREE() to be consistent with the rest of
the function.
2013-07-12 00:42:14 +02:00
Victor Stinner fb3a630001 Issue #18408: errors.c: in debug mode, calling PyErr_BadInternalCall() now
fails with an assertion error
2013-07-12 00:37:30 +02:00
Victor Stinner 365b693adc Issue #18408: ceval.c: in debug mode, convert the PyErr_Occurred() check on
exception (when getting NULL) to an assertion to detect bugs earlier
2013-07-12 00:11:58 +02:00
Victor Stinner c31df04234 Issue #18408: Oh, I was wrong: Pickler_New() must call Py_DECREF() to destroy
the newly created pickler, and not PyObject_GC_Del().
2013-07-12 00:08:59 +02:00
Victor Stinner cc35159ed8 Issue #18408: normalizestring() now raises MemoryError on memory allocation failure 2013-07-12 00:02:55 +02:00
Victor Stinner 9035ad932b Issue #18408: In debug mode, PyCFunction_Call() now checks if an exception was
raised if the result is NULL to help to find bugs in C mode (get the error
earlier than the SystemError in ceval.c).
2013-07-11 23:44:46 +02:00
Victor Stinner 526daabf34 Issue #18408: parsetok() must not write into stderr on memory allocation error
The caller gets an error code and can raise a classic Python exception.
2013-07-11 23:17:33 +02:00
Victor Stinner 71c8b7ec04 Issue #18408: Different fixes in _elementtree.c to handle correctly MemoryError
* create_new_element() initializes all attributes before handling errors,
   to fix a crash in the destructor
* create_new_element() calls PyObject_GC_Del() on error, instead of
  PyObject_Del(), because the object was created by PyObject_GC_New()
* subelement() now handles create_new_element() failure
* element_getattro() now handles element_get_text() failure
* makeuniversal() now handles PyBytes_FromStringAndSize() failure
2013-07-11 23:08:39 +02:00
Victor Stinner 4d46343340 Cleanup _elementtree.c 2013-07-11 23:05:03 +02:00
Victor Stinner 5f0af23f5e Issue #18408: _elementtree.c now handles create_extra() failure 2013-07-11 23:01:36 +02:00
Victor Stinner 68c8ea25f1 Issue #18408: Fix _Pickler_New() and _Unpickler_New(): initialize all
attributes before handling errors

_Pickler_New() now calls PyObject_GC_Del() instead of Py_DECREF() on error,
because the pickle object is created using PyObject_GC_New().

Fix a crash in the destructor when an attribute is not initiallized.
2013-07-11 22:56:25 +02:00
Victor Stinner 3bf5f530d9 Issue #18408: parsetok() must not write into stderr on memory allocation error
The caller gets an error code and can raise a classic Python exception.
2013-07-11 22:52:19 +02:00
Victor Stinner 6b64a6803e Issue #18408: Fix compiler_import() to handle PyUnicode_Substring() failure properly 2013-07-11 22:50:45 +02:00
Victor Stinner 9a4fb66966 Issue #18408: ste_new() initialize all attributes before handling error
If an attribute is not initialized, the destructor can crash
2013-07-11 22:49:00 +02:00
Victor Stinner 2e8474ddde Issue #18408: slot_tp_str() must not fallback on slot_tp_repr() on error
type->tp_str must not point to slot_tp_str() if type has no __str__ attribute,
so there is no reason for slot_tp_str() to fallback on slot_tp_str() on lookup
error. Moreover, calling PyErr_Clear() may hide a real bug like MemoryError.

If __str__ attribute is removed, slots must be updated (which is done by
type_setattro()).
2013-07-11 22:46:11 +02:00
Victor Stinner 54e4ca76c9 typeobject.c: remove trailing spaces 2013-07-11 22:42:25 +02:00
R David Murray 63194a774e Merge: #18044: Fix parsing of encoded words of the form =?utf8?q?=XX...?= 2013-07-11 15:58:07 -04:00
R David Murray 65171b28e7 #18044: Fix parsing of encoded words of the form =?utf8?q?=XX...?=
The problem was I was only checking for decimal digits after the third '?',
not for *hex* digits :(.

This changeset also fixes a couple of comment typos, deletes an unused
function relating to encoded word parsing, and removed an invalid
'if' test from the folding function that was revealed by the tests
written to validate this issue.
2013-07-11 15:52:57 -04:00
Serhiy Storchaka f9e6672ae8 Issue #17872: Fix a segfault in marshal.load() when input stream returns
more bytes than requested.
2013-07-11 22:28:18 +03:00
Serhiy Storchaka 3641a74e1c Issue #17872: Fix a segfault in marshal.load() when input stream returns
more bytes than requested.
2013-07-11 22:20:47 +03:00
Serhiy Storchaka 4fcf1b2bb7 Issue #18085: Add missed const modifier for some entries in refcounts.dat. 2013-07-11 22:00:57 +03:00
Serhiy Storchaka 244d6252f2 Issue #18085: Add missed const modifier for some entries in refcounts.dat. 2013-07-11 21:57:34 +03:00
Serhiy Storchaka 50ae3f680b Issue #18101: Tcl.split() now process strings nested in a tuple as it
do with byte strings.

Added tests for Tcl.split() and Tcl.splitline().
2013-07-11 20:36:00 +03:00
Serhiy Storchaka 275d5fdbe4 Issue #18101: Tcl.split() now process strings nested in a tuple as it
do with byte strings.

Added tests for Tcl.split() and Tcl.splitline().
2013-07-11 20:34:47 +03:00
Serhiy Storchaka e3ed4edb94 Issue #18338: `python --version` now prints version string to stdout, and
not to stderr.  Patch by Berker Peksag and Michael Dickens.
2013-07-11 20:01:17 +03:00
R David Murray e173d01231 Merge #17987: properly document support.captured_xxx. 2013-07-11 12:29:31 -04:00
R David Murray 5a33f81348 #17987: properly document support.captured_xxx.
Patch by Dmi Baranov.
2013-07-11 12:28:40 -04:00
Serhiy Storchaka a155d40ed5 Fix reference leaks introduced by the patch for issue #5308. 2013-07-11 19:19:47 +03:00
Serhiy Storchaka dfde2151ed Fix reference leaks introduced by the patch for issue #5308. 2013-07-11 19:14:26 +03:00
Serhiy Storchaka 491856074f Issue #18336. Fix a link to StreamReader's read() method. 2013-07-11 18:27:20 +03:00
Serhiy Storchaka cca40ffa97 Issue #18336. Fix a link to StreamReader's read() method. 2013-07-11 18:26:13 +03:00
Christian Heimes 6cee994674 Issue #18426: improve exception message. Courtesy of Amaury 2013-07-11 13:02:37 +02:00
Christian Heimes 7ce57d67c9 Issue #18426: improve exception message. Courtesy of Amaury 2013-07-11 13:02:30 +02:00
Christian Heimes 5ec44649df Issue #18426: Fix NULL pointer dereference in C extension import when
PyModule_GetDef() returns an error.
2013-07-11 11:23:34 +02:00
Christian Heimes 848ee099f5 Issue #18426: Fix NULL pointer dereference in C extension import when
PyModule_GetDef() returns an error.
2013-07-11 11:22:21 +02:00
R David Murray 16dbbae298 #18116: getpass no longer always falls back to stdin.
Also fixes a resource warning that occurred when the fallback is taken.

Patch by Serhiy Storchaka.

(We couldn't figure out how to write tests for this.)
2013-07-10 17:02:24 -04:00
R David Murray acb362e29f Merge: #18424: PEP8ify the tense of the sum docstring. 2013-07-10 16:22:59 -04:00
R David Murray 87ead1138d #18424: PEP8ify the tense of the sum docstring. 2013-07-10 16:22:14 -04:00
R David Murray 609142ef05 Merge: #18399: fix comment typo. 2013-07-10 11:57:39 -04:00
R David Murray 296b73c83d #18399: fix comment typo.
Patch by Andrew Rowe.
2013-07-10 10:57:39 -04:00
Victor Stinner aaa8ed8b84 Issue #18408: Fix call_exc_trace(): if the traceback is NULL, use None when
building the tuple (type, value, traceback) passed to the callback.

PyTuple_Pack() does crash if an argument is NULL.
2013-07-10 13:57:55 +02:00
Charles-François Natali 19361a2046 Issue #18308: don't take the scope ID into account when comparing IPv6
addresses.
2013-07-09 19:16:32 +02:00