Antoine Pitrou <pit...@free.fr> added the comment:

> So imagine a Future `fut` is completed. And we call `fut.add_done_callback()` 
> in different contexts with different active event loops.  With your 
> suggestion we'll schedule our callbacks in different loops.

I'm wondering: does this situation occur in practice?  Since Future isn't 
threadsafe, is there really a point in using it from several loops at once?

> Ideally you should use `loop.create_future()` when you can (and in libraries 
> you usually can do that) to always make it explicit which loop your Future is 
> attached to.

Unfortunately that's not possible in our case.  Short version: we are using 
Tornado which creates a asyncio Future eagerly, see 
https://github.com/tornadoweb/tornado/blob/master/tornado/locks.py#L199

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31960>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to