Victor Stinner [Wed, 14 Jan 2015 23:04:21 +0000 (00:04 +0100)]
asyncio: sync with Tulip
* PipeHandle now uses None instead of -1 for a closed handle
* Sort imports in windows_utils.
* Fix test_events on Python older than 3.5. Skip SSL tests on the
ProactorEventLoop if ssl.MemoryIO is missing
* Fix BaseEventLoop._create_connection_transport(). Close the transport if the
creation of the transport (if the waiter) gets an exception.
* _ProactorBasePipeTransport now sets _sock to None when the transport is
closed.
* Fix BaseSubprocessTransport.close(). Ignore pipes for which the protocol is
not set yet (still equal to None).
* TestLoop.close() now calls the close() method of the parent class
(BaseEventLoop).
* Cleanup BaseSelectorEventLoop: create the protocol on a separated line for
readability and ease debugging.
* Fix BaseSubprocessTransport._kill_wait(). Set the _returncode attribute, so
close() doesn't try to terminate the process.
* Tests: explicitly close event loops and transports
* UNIX pipe transports: add closed/closing in repr(). Add "closed" or "closing"
state in the __repr__() method of _UnixReadPipeTransport and
_UnixWritePipeTransport classes.
Victor Stinner [Wed, 14 Jan 2015 01:10:33 +0000 (02:10 +0100)]
Python issue #23173: sync with Tulip
* If an exception is raised during the creation of a subprocess, kill the
subprocess (close pipes, kill and read the return status). Log an error in
such case.
* Fix SubprocessStreamProtocol.connection_made() to handle cancelled waiter.
Add unit test cancelling subprocess methods.
Victor Stinner [Tue, 13 Jan 2015 23:53:37 +0000 (00:53 +0100)]
Issue #23198: Reactor asyncio.StreamReader
- Add a new _wakeup_waiter() method
- Replace _create_waiter() method with a _wait_for_data() coroutine function
- Use the value None instead of True or False to wake up the waiter
Victor Stinner [Tue, 13 Jan 2015 23:19:09 +0000 (00:19 +0100)]
Issue #22560: New SSL implementation based on ssl.MemoryBIO
The new SSL implementation is based on the new ssl.MemoryBIO which is only
available on Python 3.5. On Python 3.4 and older, the legacy SSL implementation
(using SSL_write, SSL_read, etc.) is used. The proactor event loop only
supports the new implementation.
The new asyncio.sslproto module adds _SSLPipe, SSLProtocol and
_SSLProtocolTransport classes. _SSLPipe allows to "wrap" or "unwrap" a socket
(switch between cleartext and SSL/TLS).
Patch written by Antoine Pitrou. sslproto.py is based on gruvi/ssl.py of the
gruvi project written by Geert Jansen.
This change adds SSL support to ProactorEventLoop on Python 3.5 and newer!
It becomes also possible to implement STARTTTLS: switch a cleartext socket to
SSL.
Victor Stinner [Tue, 13 Jan 2015 15:11:19 +0000 (16:11 +0100)]
Issue #22922: Fix ProactorEventLoop.close()
Close the IocpProactor before closing the event loop. IocpProactor.close() can
call loop.call_soon(), which is forbidden when the event loop is closed.
Victor Stinner [Tue, 13 Jan 2015 08:58:33 +0000 (09:58 +0100)]
Issue #23209, #23225: selectors.BaseSelector.close() now clears its internal
reference to the selector mapping to break a reference cycle. Initial patch
written by Martin Richard.
Victor Stinner [Fri, 9 Jan 2015 20:32:05 +0000 (21:32 +0100)]
asyncio: sync with Tulip
* Tulip issue 184: FlowControlMixin constructor now get the event loop if the
loop parameter is not set. Add unit tests to ensure that constructor of
StreamReader and StreamReaderProtocol classes get the event loop.
* Remove outdated TODO/XXX
Victor Stinner [Fri, 9 Jan 2015 00:42:52 +0000 (01:42 +0100)]
asyncio: sync with Tulip
* Document why set_result() calls are safe
* Cleanup gather(). Use public methods instead of hacks to consume the
exception of a future.
* sock_connect(): pass directly the fd to _sock_connect_done instead of the
socket.
Nick Coghlan [Tue, 6 Jan 2015 14:22:00 +0000 (00:22 +1000)]
Issue 19548: update codecs module documentation
- clarified the distinction between text encodings and other codecs
- clarified relationship with builtin open and the io module
- consolidated documentation of error handlers into one section
- clarified type constraints of some behaviours
- added tests for some of the new statements in the docs
Victor Stinner [Tue, 6 Jan 2015 12:54:58 +0000 (13:54 +0100)]
Issue #21356: Make ssl.RAND_egd() optional to support LibreSSL. The
availability of the function is checked during the compilation. Patch written
by Bernard Spil.
Victor Stinner [Tue, 6 Jan 2015 11:21:26 +0000 (12:21 +0100)]
Issue #20896, #22935: The ssl.get_server_certificate() function now uses the
ssl.PROTOCOL_SSLv23 protocol by default, not ssl.PROTOCOL_SSLv3, for maximum
compatibility and support platforms where ssl.PROTOCOL_SSLv3 support is
disabled.
Victor Stinner [Fri, 26 Dec 2014 20:07:52 +0000 (21:07 +0100)]
Issue #22926: In debug mode, call_soon(), call_at() and call_later() methods of
asyncio.BaseEventLoop now use the identifier of the current thread to ensure
that they are called from the thread running the event loop.
Before, the get_event_loop() method was used to check the thread, and no
exception was raised when the thread had no event loop. Now the methods always
raise an exception in debug mode when called from the wrong thread. It should
help to notice misusage of the API.
Victor Stinner [Thu, 18 Dec 2014 22:47:27 +0000 (23:47 +0100)]
asyncio: sync with Tulip
* Fix a race condition in BaseSubprocessTransport._try_finish().
If the process exited before the _post_init() method was called, scheduling
the call to _call_connection_lost() with call_soon() is wrong:
connection_made() must be called before connection_lost().
Reuse the BaseSubprocessTransport._call() method to schedule the call to
_call_connection_lost() to ensure that connection_made() and
connection_lost() are called in the correct order.
Serhiy Storchaka [Tue, 16 Dec 2014 16:00:56 +0000 (18:00 +0200)]
Issue #19858: pickletools.optimize() now aware of the MEMOIZE opcode, can
produce more compact result and no longer produces invalid output if input
data contains MEMOIZE opcodes together with PUT or BINPUT opcodes.
Ned Deily [Sat, 13 Dec 2014 08:17:46 +0000 (00:17 -0800)]
Issue #17128: Use private version of OpenSSL for 3.x OS X 10.5+ installers.
Among other issues, the Apple-supplied 0.9.7 libs for the 10.5 ABI cannot
verify newer SHA-256 certs as now used by python.org services. Document
in the installer ReadMe some of the certificate management issues that
users now need to be more concerned with due to PEP 476's enabling cert
verification by default. For now, continue to use the Apple-supplied
0.9.8 libs for the 10.6+ installer since they use Apple private APIs to
verify certificates using the system- and user-managed CA keychain stores.
Victor Stinner [Fri, 12 Dec 2014 12:17:41 +0000 (13:17 +0100)]
Issue #18028: Fix aliasing issue in READ_TIMESTAMP() of ceval.c on x86_64,
when Python is configure with --with-tsc. Patch written by Christian Heimes.