[Python-checkins] cpython (merge 3.6 -> default): Issue #28430: Fix iterator of C implemented asyncio.Future doesn't

inada.naoki python-checkins at python.org
Tue Oct 25 06:11:58 EDT 2016


https://hg.python.org/cpython/rev/bd141ec2973a
changeset:   104699:bd141ec2973a
parent:      104697:17334c1d9245
parent:      104698:b471447352ac
user:        INADA Naoki <songofacandy at gmail.com>
date:        Tue Oct 25 19:11:40 2016 +0900
summary:
  Issue #28430: Fix iterator of C implemented asyncio.Future doesn't
accept non-None value is passed to it.send(val).

files:
  Misc/NEWS                |   3 +++
  Modules/_asynciomodule.c |  10 ++++------
  2 files changed, 7 insertions(+), 6 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -97,6 +97,9 @@
 Library
 -------
 
+- Issue #28430: Fix iterator of C implemented asyncio.Future doesn't accept
+  non-None value is passed to it.send(val).
+
 - Issue #27025: Generated names for Tkinter widgets now start by the "!" prefix
   for readability (was "`").
 
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -815,13 +815,11 @@
 }
 
 static PyObject *
-FutureIter_send(futureiterobject *self, PyObject *arg)
+FutureIter_send(futureiterobject *self, PyObject *unused)
 {
-    if (arg != Py_None) {
-        PyErr_Format(PyExc_TypeError,
-                     "can't send non-None value to a FutureIter");
-        return NULL;
-    }
+    /* Future.__iter__ doesn't care about values that are pushed to the
+     * generator, it just returns "self.result().
+     */
     return FutureIter_iternext(self);
 }
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list