Issue #18457: Fixed saving of formulas and complex numbers in Tools/demo/ss1.py.
Useed context managers for file I/O.
Removed out-of-dated code and misleading comments.
Issue #18457: Fixed saving of formulas and complex numbers in Tools/demo/ss1.py.
Useed context managers for file I/O.
Removed out-of-dated code and misleading comments.
Victor Stinner [Mon, 15 Jul 2013 23:54:37 +0000 (01:54 +0200)]
Issue #18408: Fix show_warning(), clear also the exception raised by
_Py_DisplaySourceLine()
For example, _PyGC_DumpShutdownStats() calls PyErr_WarnExplicitFormat() while
the import machinery does not work anymore, _Py_DisplaySourceLine() fails when
trying to import the io module.
Victor Stinner [Mon, 15 Jul 2013 16:22:47 +0000 (18:22 +0200)]
Issue #18408: Don't check unicode consistency in _PyUnicode_HAS_UTF8_MEMORY()
and _PyUnicode_HAS_WSTR_MEMORY() macros
These macros are called in unicode_dealloc(), whereas the unicode object can be
"inconsistent" if the creation of the object failed.
For example, when unicode_subtype_new() fails on a memory allocation,
_PyUnicode_CheckConsistency() fails with an assertion error because data is
NULL.
Victor Stinner [Mon, 15 Jul 2013 15:50:07 +0000 (17:50 +0200)]
Issue #18408: PyObject_Call() now fails with an assertion error in debug mode
if the function called failed whereas no exception was raised, to detect bugs
earlier.
Ronald Oussoren [Mon, 15 Jul 2013 16:32:09 +0000 (18:32 +0200)]
Issue #18393: Remove use of deprecated API on OSX
The "Gestalt" function on OSX is deprecated (starting with OSX 10.8),
remove its usage from the stdlib. The patch removes a number of private
functions and a private module, but does not change the public API.
The removed code was effectively dead, the platform module has used
other code to fetch the OSX version for years and could only use
on the Gestalt-based code as a fallback. That fallback can only trigger
on broken OSX installs (that is, someone has removed parts of the system
install)
Terry Jan Reedy [Sat, 13 Jul 2013 06:34:43 +0000 (02:34 -0400)]
Issue #18279: Add tests for idlelib/RstripExtension.py. Original patch by
Phil Webster. With that available, modify RstripExtension.py to stop deleting
null slices, which caused a file to be marked as changed when it was not.
R David Murray [Fri, 12 Jul 2013 20:00:28 +0000 (16:00 -0400)]
#18431: Decode encoded words in atoms in new email parser.
There is more to be done here in terms of accepting RFC invalid
input that some mailers accept, but this covers the valid
RFC places where encoded words can occur in structured headers.
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.
Victor Stinner [Thu, 11 Jul 2013 21:44:46 +0000 (23:44 +0200)]
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).
Victor Stinner [Thu, 11 Jul 2013 21:08:39 +0000 (23:08 +0200)]
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
Victor Stinner [Thu, 11 Jul 2013 20:46:11 +0000 (22:46 +0200)]
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()).
R David Murray [Thu, 11 Jul 2013 19:52:57 +0000 (15:52 -0400)]
#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.