[Python-checkins] cpython (3.5): Another asyncio sync.
yury.selivanov
python-checkins at python.org
Thu Sep 15 13:50:33 EDT 2016
https://hg.python.org/cpython/rev/325a76c4c292
changeset: 103827:325a76c4c292
branch: 3.5
parent: 103814:bf07ff6d072e
user: Yury Selivanov <yury at magic.io>
date: Thu Sep 15 13:49:08 2016 -0400
summary:
Another asyncio sync.
files:
Lib/asyncio/base_events.py | 9 +++++----
Lib/asyncio/tasks.py | 7 ++++++-
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -13,7 +13,6 @@
to modify the meaning of the API call itself.
"""
-
import collections
import concurrent.futures
import heapq
@@ -1128,7 +1127,7 @@
transport = yield from self._make_subprocess_transport(
protocol, cmd, True, stdin, stdout, stderr, bufsize, **kwargs)
if self._debug:
- logger.info('%s: %r' % (debug_log, transport))
+ logger.info('%s: %r', debug_log, transport)
return transport, protocol
@coroutine
@@ -1158,7 +1157,7 @@
protocol, popen_args, False, stdin, stdout, stderr,
bufsize, **kwargs)
if self._debug:
- logger.info('%s: %r' % (debug_log, transport))
+ logger.info('%s: %r', debug_log, transport)
return transport, protocol
def get_exception_handler(self):
@@ -1238,7 +1237,9 @@
- 'handle' (optional): Handle instance;
- 'protocol' (optional): Protocol instance;
- 'transport' (optional): Transport instance;
- - 'socket' (optional): Socket instance.
+ - 'socket' (optional): Socket instance;
+ - 'asyncgen' (optional): Asynchronous generator that caused
+ the exception.
New keys maybe introduced in the future.
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py
--- a/Lib/asyncio/tasks.py
+++ b/Lib/asyncio/tasks.py
@@ -519,7 +519,7 @@
h.cancel()
-def async(coro_or_future, *, loop=None):
+def async_(coro_or_future, *, loop=None):
"""Wrap a coroutine in a future.
If the argument is a Future, it is returned directly.
@@ -532,6 +532,11 @@
return ensure_future(coro_or_future, loop=loop)
+# Silence DeprecationWarning:
+globals()['async'] = async_
+async_.__name__ = 'async'
+del async_
+
def ensure_future(coro_or_future, *, loop=None):
"""Wrap a coroutine or an awaitable in a future.
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list