From: Serhiy Storchaka Date: Sun, 20 May 2018 14:33:55 +0000 (+0300) Subject: [3.6] bpo-33584: Fix several minor bugs in asyncio. (GH-7003) (#7006) X-Git-Tag: v3.6.6rc1~114 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=49418f6df7a234243a470260e1b59e9e4c0e4768;p=thirdparty%2FPython%2Fcpython.git [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) --- 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 @@ class Task(futures.Future): 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 @@ set_exception: } 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(