Zachary Ware [Wed, 8 Apr 2015 01:38:53 +0000 (20:38 -0500)]
Fix prepare_ssl.py for OpenSSL 1.0.2a builds without Perl (using old system).
This change affects the makefiles checked into svn.python.org, which the 3.5
build no longer uses. 3.4 and 2.7 both still use those makefiles, but their
build_ssl.py scripts don't require an update; if the script is running the
'fix_makefiles' method it already has Perl available anyway.
Addresses Issue #10838: The subprocess now module includes
SubprocessError and TimeoutError in its list of exported names for the
users wild enough to use "from subprocess import *".
MAXFD, mswindows and list2cmdline should be dealt with (renamed or
moved) in separate commits.
Committed at 35,000ft. Thanks chromebook free gogo wifi passes!
Victor Stinner [Tue, 7 Apr 2015 19:38:04 +0000 (21:38 +0200)]
Issue #23879, asyncio: SelectorEventLoop.sock_connect() must not call connect()
again if the first call to connect() raises an InterruptedError.
When the C function connect() fails with EINTR, the connection runs in
background. We have to wait until the socket becomes writable to be notified
when the connection succeed or fails.
Issue #23411: Added DefragResult, ParseResult, SplitResult, DefragResultBytes,
ParseResultBytes, and SplitResultBytes to urllib.parse.__all__.
Patch by Martin Panter.
Victor Stinner [Mon, 6 Apr 2015 20:46:13 +0000 (22:46 +0200)]
Issue #23853: Methods of SSL socket don't reset the socket timeout anymore each
time bytes are received or sent. The socket timeout is now the maximum total
duration of the method.
This change fixes a denial of service if the application is regulary
interrupted by a signal and the signal handler does not raise an exception.
Victor Stinner [Mon, 6 Apr 2015 21:16:34 +0000 (23:16 +0200)]
Issue #23853: socket.socket.sendall() does no more reset the socket timeout
each time data is sent successfuly. The socket timeout is now the maximum total
duration to send all data.
Victor Stinner [Mon, 6 Apr 2015 21:06:01 +0000 (23:06 +0200)]
Issue #23834: Fix initial value of the socket timeout
Use _PyTime_FromSeconds() to initialize the default socket timeout to -1
second, instead of -1 nanosecond which causes rounding issues in
internal_select().
Issue #22721: An order of multiline pprint output of set or dict containing
orderable and non-orderable elements no longer depends on iteration order of
set or dict.
R David Murray [Sun, 5 Apr 2015 23:26:29 +0000 (19:26 -0400)]
#3566: Clean up handling of remote server disconnects.
This changeset does two things: introduces a new RemoteDisconnected exception
(that subclasses ConnectionResetError and BadStatusLine) so that a remote
server disconnection can be detected by client code (and provides a better
error message for debugging purposes), and ensures that the client socket is
closed if a ConnectionError happens, so that the automatic re-connection code
can work if the application handles the error and continues on.
Tests are added that confirm that a connection is re-used or not re-used
as appropriate to the various combinations of protocol version and headers.
Patch by Martin Panter, reviewed by Demian Brecht. (Tweaked only slightly by
me.)
Fixed the array module broken in issue #23492.
array_array_frombytes() is used in other functions, but it's signature was
changed. Closes issue #23866.
Larry Hastings [Fri, 3 Apr 2015 20:09:02 +0000 (13:09 -0700)]
Issue #23500: Argument Clinic is now smarter about generating the "#ifndef"
(empty) definition of the methoddef macro: it's only generated once, even
if Argument Clinic processes the same symbol multiple times, and it's emitted
at the end of all processing rather than immediately after the first use.
Victor Stinner [Thu, 2 Apr 2015 19:28:28 +0000 (21:28 +0200)]
Issue #23853: Cleanup _ssl.c
* Rename check_socket_and_wait_for_timeout() to PySSL_select()
* PySSL_select() is now clearly splitted betwen poll() and select()
* Add empty lines for readability
Victor Stinner [Fri, 3 Apr 2015 11:22:27 +0000 (13:22 +0200)]
Issue #23834: Simplify timeout handling
* Use the new _PyTime_FromSeconds() function to set the timeout to -1 second
for socket.settimeout(None). It avoids a special case in internal_select()
because of a rounding issue: -1 nanosecond is rounded to 0 millisecond which
means non-blocking, instead of blocking.
* Check if the interval the negative in sock_call_ex() instead of doing the
check in internal_select(). sock_call_ex() remembers if the socket has a
timeout or not, which avoids a race condition if the timeout is modified in a
different thread.