allow NullFutures in gen.multi
is_future() only accepts 'real' futures, but NullFutures work here, too.
This commit is contained in:
parent
f4e6529225
commit
4b464ffc63
|
@ -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()
|
||||
|
|
|
@ -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__':
|
||||
|
|
Loading…
Reference in New Issue