Serhiy Storchaka [Tue, 24 Mar 2015 20:30:46 +0000 (22:30 +0200)]
Issue #23671: string.Template now allows to specify the "self" parameter as
keyword argument. string.Formatter now allows to specify the "self" and
the "format_string" parameters as keyword arguments.
Serhiy Storchaka [Tue, 24 Mar 2015 20:28:43 +0000 (22:28 +0200)]
Issue #23671: string.Template now allows to specify the "self" parameter as
keyword argument. string.Formatter now allows to specify the "self" and
the "format_string" parameters as keyword arguments.
Serhiy Storchaka [Tue, 24 Mar 2015 19:55:47 +0000 (21:55 +0200)]
Issue #23573: Increased performance of string search operations (str.find,
str.index, str.count, the in operator, str.split, str.partition) with
arguments of different kinds (UCS1, UCS2, UCS4).
Serhiy Storchaka [Tue, 24 Mar 2015 16:06:42 +0000 (18:06 +0200)]
Issue #20289: The copy module now uses pickle protocol 4 (PEP 3154) and
supports copying of instances of classes whose __new__ method takes
keyword-only arguments.
Victor Stinner [Tue, 24 Mar 2015 15:28:52 +0000 (16:28 +0100)]
Issue #23571: Enhance _Py_CheckFunctionResult()
Too bad, sometimes Py_FatalError() is unable to write the exception into
sys.stderr (on "AMD64 OpenIndiana 3.x" buildbot, the buildbot was probably out
of memory).
Call Py_FatalError() with a different message for the two cases (result+error,
or no result and no error).
Victor Stinner [Tue, 24 Mar 2015 12:46:18 +0000 (13:46 +0100)]
(Merge 3.4) Issue #23571: Py_FatalError() now tries to flush sys.stdout and
sys.stderr
It should help to see exceptions when stderr if buffered: PyErr_Display() calls
sys.stderr.write(), it doesn't write into stderr file descriptor directly.
Victor Stinner [Tue, 24 Mar 2015 12:44:35 +0000 (13:44 +0100)]
Issue #23571: Py_FatalError() now tries to flush sys.stdout and sys.stderr
It should help to see exceptions when stderr if buffered: PyErr_Display() calls
sys.stderr.write(), it doesn't write into stderr file descriptor directly.
Victor Stinner [Tue, 24 Mar 2015 11:53:59 +0000 (12:53 +0100)]
Issue #23571: In debug mode, _Py_CheckFunctionResult() now calls
Py_FatalError() instead of using an assertion in debug mode. Py_FatalError()
displays the current exception and the traceback which contain more information
than just the assertion error.
Victor Stinner [Tue, 24 Mar 2015 11:41:23 +0000 (12:41 +0100)]
Issue #23571: PyErr_FormatV() and PyErr_SetObject() now always clear the
current exception because they can run arbitrary Python code and so no
exception must be set.
Victor Stinner [Tue, 24 Mar 2015 11:16:28 +0000 (12:16 +0100)]
Issue #23753: Move _Py_wstat() from Python/fileutils.c to Modules/getpath.c
I expected more users of _Py_wstat(), but in practice it's only used by
Modules/getpath.c. Move the function because it's not needed on Windows.
Windows uses PC/getpathp.c which uses the Win32 API (ex: GetFileAttributesW())
not the POSIX API.
Victor Stinner [Tue, 24 Mar 2015 11:01:30 +0000 (12:01 +0100)]
(Merge 3.4) Issue #23571: Enhance Py_FatalError()
* Display the current Python stack if an exception was raised but the exception
has no traceback
* Disable faulthandler if an exception was raised (before it was only disabled
if no exception was raised)
* To display the current Python stack, call PyGILState_GetThisThreadState()
which works even if the GIL was released
Victor Stinner [Tue, 24 Mar 2015 10:24:06 +0000 (11:24 +0100)]
Issue #23571: Enhance Py_FatalError()
* Display the current Python stack if an exception was raised but the exception
has no traceback
* Disable faulthandler if an exception was raised (before it was only disabled
if no exception was raised)
* To display the current Python stack, call PyGILState_GetThisThreadState()
which works even if the GIL was released
Serhiy Storchaka [Mon, 23 Mar 2015 12:59:48 +0000 (14:59 +0200)]
Issue #23688: Added support of arbitrary bytes-like objects and avoided
unnecessary copying of memoryview in gzip.GzipFile.write().
Original patch by Wolfgang Maier.
Serhiy Storchaka [Sun, 22 Mar 2015 07:46:36 +0000 (09:46 +0200)]
Issue #22079: Deprecation warning now is issued in PyType_Ready() instead of
raising TypeError when statically allocated type subclasses dynamically
allocated type
Victor Stinner [Sat, 21 Mar 2015 14:04:43 +0000 (15:04 +0100)]
Issue #23571: _Py_CheckFunctionResult() now gives the name of the function
which returned an invalid result (result+error or no result without error) in
the exception message.
Add also unit test to check that the exception contains the name of the
function.
Special case: the final _PyEval_EvalFrameEx() check doesn't mention the
function since it didn't execute a single function but a whole frame.
Serhiy Storchaka [Sat, 21 Mar 2015 07:41:19 +0000 (09:41 +0200)]
Issue #22351: The nntplib.NNTP constructor no longer leaves the connection
and socket open until the garbage collector cleans them up. Patch by
Martin Panter.
Serhiy Storchaka [Sat, 21 Mar 2015 07:40:26 +0000 (09:40 +0200)]
Issue #22351: The nntplib.NNTP constructor no longer leaves the connection
and socket open until the garbage collector cleans them up. Patch by
Martin Panter.
Serhiy Storchaka [Fri, 20 Mar 2015 18:04:21 +0000 (20:04 +0200)]
Issue #22832: Tweaked parameter names for fcntl module to better match
official POSIX documentation. Updated the documenttion for Python 3.
Patch by Alex Shkop.
R David Murray [Fri, 20 Mar 2015 15:31:38 +0000 (11:31 -0400)]
#11726: Make linecache docs reflect that all files are treated the same.
Being able to read non-python text files is not a purpose of linecache, but it
does work and people use it. This changeset adjusts the language to make it
clear that Python files are not treated uniquely, but does not go so far as to
say reading non-python files is explicitly supported.
Serhiy Storchaka [Fri, 20 Mar 2015 14:12:43 +0000 (16:12 +0200)]
Issue #23700: NamedTemporaryFile iterator closed underlied file object in
some circunstances while NamedTemporaryFile object was living. This causes
failing test_csv. Changed the implementation of NamedTemporaryFile.__iter__
to make tests passed.
Serhiy Storchaka [Fri, 20 Mar 2015 14:11:20 +0000 (16:11 +0200)]
Issue #23700: NamedTemporaryFile iterator closed underlied file object in
some circunstances while NamedTemporaryFile object was living. This causes
failing test_csv. Changed the implementation of NamedTemporaryFile.__iter__
to make tests passed.
Victor Stinner [Fri, 20 Mar 2015 12:48:36 +0000 (13:48 +0100)]
Issue #23696: Remove test on ZipImportError.__context__ because the context is
None on Windows.
When the file is not readable, the error occurs at open on UNIX. On Windows,
the error only occurs at the first operation on the open file. It would require
to many changes to set __context__ to an OSError for all file operations, for a
little benefit (__context__ is almost never used).
Victor Stinner [Fri, 20 Mar 2015 11:54:28 +0000 (12:54 +0100)]
Issue #23715: signal.sigwaitinfo() and signal.sigtimedwait() are now retried
when interrupted by a signal not in the *sigset* parameter, if the signal
handler does not raise an exception. signal.sigtimedwait() recomputes the
timeout with a monotonic clock when it is retried.
Remove test_signal.test_sigwaitinfo_interrupted() because sigwaitinfo() doesn't
raise InterruptedError anymore if it is interrupted by a signal not in its
sigset parameter.
Victor Stinner [Fri, 20 Mar 2015 10:21:41 +0000 (11:21 +0100)]
Issue #23708: Split assertion expression in two assertions in _Py_read() and
_Py_write() to know which test failed on the buildbot "AMD64 Snow Leop 3.x".
Serhiy Storchaka [Fri, 20 Mar 2015 07:21:59 +0000 (09:21 +0200)]
Issue #22826: The result of open() in Tools/freeze/bkfile.py is now better
compatible with regular files (in particular it now supports the context
management protocol).
Serhiy Storchaka [Fri, 20 Mar 2015 07:00:36 +0000 (09:00 +0200)]
Issue #23001: Few functions in modules mmap, ossaudiodev, socket, ssl, and
codecs, that accepted only read-only bytes-like object now accept writable
bytes-like object too.
Victor Stinner [Fri, 20 Mar 2015 00:42:20 +0000 (01:42 +0100)]
Issue #23646: Enhance precision of time.sleep() and socket timeout when
interrupted by a signal
Add a new _PyTime_AddDouble() function and remove _PyTime_ADD_SECONDS() macro.
The _PyTime_ADD_SECONDS only supported an integer number of seconds, the
_PyTime_AddDouble() has subsecond resolution.
Victor Stinner [Thu, 19 Mar 2015 21:53:20 +0000 (22:53 +0100)]
Issue #23708: Add _Py_read() and _Py_write() functions to factorize code handle
EINTR error and special cases for Windows.
These functions now truncate the length to PY_SSIZE_T_MAX to have a portable
and reliable behaviour. For example, read() result is undefined if counter is
greater than PY_SSIZE_T_MAX on Linux.
Victor Stinner [Thu, 19 Mar 2015 20:54:09 +0000 (21:54 +0100)]
Issue #23646: If time.sleep() is interrupted by a signal, the sleep is now
retried with the recomputed delay, except if the signal handler raises an
exception (PEP 475).
Modify also test_signal to use a monotonic clock instead of the system clock.