Serhiy Storchaka [Tue, 31 Mar 2015 10:17:10 +0000 (13:17 +0300)]
Issue #18473: Fixed 2to3 and 3to2 compatible pickle mappings.
Fixed ambigious reverse mappings. Added many new mappings. Import mapping
is no longer applied to modules already mapped with full name mapping.
Added tests for compatible pickling and unpickling and for consistency of
_compat_pickle mappings.
Serhiy Storchaka [Tue, 31 Mar 2015 10:12:37 +0000 (13:12 +0300)]
Issue #18473: Fixed 2to3 and 3to2 compatible pickle mappings.
Fixed ambigious reverse mappings. Added many new mappings. Import mapping
is no longer applied to modules already mapped with full name mapping.
Added tests for compatible pickling and unpickling and for consistency of
_compat_pickle mappings.
Victor Stinner [Mon, 30 Mar 2015 19:16:11 +0000 (21:16 +0200)]
Issue #23485: select.select() is now retried automatically with the recomputed
timeout when interrupted by a signal, except if the signal handler raises an
exception. This change is part of the PEP 475.
The asyncore and selectors module doesn't catch the InterruptedError exception
anymore when calling select.select(), since this function should not raise
InterruptedError anymore.
R David Murray [Mon, 30 Mar 2015 14:14:47 +0000 (10:14 -0400)]
#23792: also catch interrupt around pipe.write.
The previous patch only dealt with KeyboardInterrupt when all of the
data had been consumed by the pager. This deals with the interrupt
when some data is still pending.
R David Murray [Mon, 30 Mar 2015 01:53:05 +0000 (21:53 -0400)]
#23745: handle duplicate MIME parameter names in new parser.
This mimics get_param's error handling for the most part. It is slightly
better in some regards as get_param can produce some really weird results for
duplicate *0* parts. It departs from get_param slightly in that if we have a
mix of non-extended and extended pieces for the same parameter name, the new
parser assumes they were all supposed to be extended and concatenates all the
values, whereas get_param always picks the non-extended parameter value. All
of this error recovery is pretty much arbitrary decisions...
Victor Stinner [Mon, 30 Mar 2015 01:21:06 +0000 (03:21 +0200)]
Issue #23752: When built from an existing file descriptor, io.FileIO() now only
calls fstat() once. Before fstat() was called twice, which was not necessary.
Victor Stinner [Mon, 30 Mar 2015 00:18:31 +0000 (02:18 +0200)]
Issue #23694: Fix usage of _Py_open() in the _posixsubprocess module
Don't call _Py_open() from _close_open_fds_safe() because it is call just after
fork(). It's not good to play with locks (the GIL) between fork() and exec().
Use instead _Py_open_noraise() which doesn't touch to the GIL.
Victor Stinner [Sun, 29 Mar 2015 23:10:14 +0000 (01:10 +0200)]
Issue #22117: Fix rounding of fromtimestamp() methods of datetime.datetime and
datetime.time: round towards minus infinity ("floor") instead of rounding
towards zero ("down").
R David Murray [Sun, 29 Mar 2015 19:15:40 +0000 (15:15 -0400)]
#23792: Ignore KeyboardInterrupt when the pydoc pager is active.
Previously, if you hit ctl-c while the pager was active, the python that
launched the subprocess for the pager would see the KeyboardInterrupt in the
__exit__ method of the subprocess context manager where it was waiting for the
subprocess to complete, ending the wait. This would leave the pager running,
while the interactive interpreter, after handling the exception by printing
it, would go back to trying to post a prompt...but the pager would generally
have the terminal in raw mode, and in any case would be still trying to read
from stdin. On some systems, even exiting python at that point would not
restore the terminal mode. The problem with raw mode could also happen if
ctl-C was hit when pydoc was called from the shell command line and the pager
was active.
Instead, we now wait on the subprocess in a loop, ignoring KeyboardInterrupt
just like the pager does, until the pager actually exits.
(Note: this was a regression relative to python2...in python2 the pager
is called via system, and system does not return until the pager exits.)
Victor Stinner [Sat, 28 Mar 2015 04:24:19 +0000 (05:24 +0100)]
Issue #22117: Fix _PyTime_GetMonotonicClock() and
_PyTime_GetSystemClockWithInfo() to not raise an exception and return 0 on
error (it should never occur)
Victor Stinner [Sat, 28 Mar 2015 04:02:39 +0000 (05:02 +0100)]
Issue #22117: Add the new _PyTime_ROUND_FLOOR rounding method for the datetime
module. time.clock_settime() now uses this rounding method instead of
_PyTime_ROUND_DOWN to handle correctly dates before 1970.
Victor Stinner [Sat, 28 Mar 2015 02:52:05 +0000 (03:52 +0100)]
Issue #22117: The thread module uses the new _PyTime_t timestamp API
Add also a new _PyTime_AsMicroseconds() function.
threading.TIMEOUT_MAX is now be smaller: only 292 years instead of 292,271
years on 64-bit system for example. Sorry, your threads will hang a *little
bit* shorter. Call me if you want to ensure that your locks wait longer, I can
share some tricks with you.
Victor Stinner [Sat, 28 Mar 2015 00:26:47 +0000 (01:26 +0100)]
Issue #22117: Write unit tests for _PyTime_AsTimeval()
* _PyTime_AsTimeval() now ensures that tv_usec is always positive
* _PyTime_AsTimespec() now ensures that tv_nsec is always positive
* _PyTime_AsTimeval() now returns an integer on overflow instead of raising an
exception