diff --git a/tornado/gen.py b/tornado/gen.py index 2b51c5f8..0ceda1d5 100644 --- a/tornado/gen.py +++ b/tornado/gen.py @@ -814,10 +814,7 @@ def multi_future(children, quiet_exceptions=()): else: keys = None children = list(map(convert_yielded, children)) - # filter out NullFutures, like gen.moment - children = [child for child in children - if not isinstance(child, _NullFuture)] - assert all(is_future(i) for i in children) + assert all(is_future(i) or isinstance(i, _NullFuture) for i in children) unfinished_children = set(children) future = _create_future() diff --git a/tornado/test/gen_test.py b/tornado/test/gen_test.py index f33ac3ca..12621cec 100644 --- a/tornado/test/gen_test.py +++ b/tornado/test/gen_test.py @@ -1603,10 +1603,12 @@ class RunnerGCTest(AsyncTestCase): # now that it's not a real Future @gen.coroutine def wait_a_moment(): - yield gen.multi([gen.moment, gen.moment]) + result = yield gen.multi([gen.moment, gen.moment]) + raise gen.Return(result) loop = self.get_new_ioloop() - loop.run_sync(wait_a_moment) + result = loop.run_sync(wait_a_moment) + self.assertEqual(result, [None, None]) if __name__ == '__main__':