]> granicus.if.org Git - python/commitdiff
Issue #28430: Fix iterator of C implemented asyncio.Future doesn't
authorINADA Naoki <songofacandy@gmail.com>
Tue, 25 Oct 2016 10:00:45 +0000 (19:00 +0900)
committerINADA Naoki <songofacandy@gmail.com>
Tue, 25 Oct 2016 10:00:45 +0000 (19:00 +0900)
accept non-None value is passed to it.send(val).

Misc/NEWS
Modules/_asynciomodule.c

index 563f0c0a46702361cced44d5462d4673e12cf1b0..655e22c9feab9689f8dde8e16177ea94f4f4da44 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -29,6 +29,9 @@ Core and Builtins
 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 "`").
 
index 37298cc46492a2108372b50b1acfdbdef2244acd..a3c96c8d4abaaad771e3aec1191cb8ba13215b1c 100644 (file)
@@ -815,13 +815,11 @@ FutureIter_iternext(futureiterobject *it)
 }
 
 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);
 }