[Python-checkins] [3.6] bpo-33584: Fix several minor bugs in asyncio. (GH-7003) (#7006)
Serhiy Storchaka
webhook-mailer at python.org
Sun May 20 10:33:58 EDT 2018
https://github.com/python/cpython/commit/49418f6df7a234243a470260e1b59e9e4c0e4768
commit: 49418f6df7a234243a470260e1b59e9e4c0e4768
branch: 3.6
author: Serhiy Storchaka <storchaka at gmail.com>
committer: GitHub <noreply at github.com>
date: 2018年05月20日T17:33:55+03:00
summary:
[3.6] bpo-33584: Fix several minor bugs in asyncio. (GH-7003) (#7006)
* repr() was called for a borrowed link.
* str() was used instead of repr() in formatting one error message.
(cherry picked from commit 6655354afcd116c27486bb5ba1dfa50b369d8d85)
files:
M Lib/asyncio/tasks.py
M Modules/_asynciomodule.c
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py
index 9fe2a2fabf07..a294dfbf5e57 100644
--- a/Lib/asyncio/tasks.py
+++ b/Lib/asyncio/tasks.py
@@ -233,7 +233,7 @@ def _step(self, exc=None):
self._step,
RuntimeError(
'yield was used instead of yield from for '
- 'generator in task {!r} with {}'.format(
+ 'generator in task {!r} with {!r}'.format(
self, result)))
else:
# Yielding something else is an error.
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index f53387115e73..1430097f82da 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -2248,19 +2248,19 @@ task_step_impl(TaskObj *task, PyObject *exc)
}
if (res == 1) {
/* `result` is a generator */
- PyObject *ret;
- ret = task_set_error_soon(
+ o = task_set_error_soon(
task, PyExc_RuntimeError,
"yield was used instead of yield from for "
- "generator in task %R with %S", task, result);
+ "generator in task %R with %R", task, result);
Py_DECREF(result);
- return ret;
+ return o;
}
/* The `result` is none of the above */
- Py_DECREF(result);
- return task_set_error_soon(
+ o = task_set_error_soon(
task, PyExc_RuntimeError, "Task got bad yield: %R", result);
+ Py_DECREF(result);
+ return o;
self_await:
o = task_set_error_soon(
More information about the Python-checkins
mailing list