New submission from Ben Mather: Adds `remove_done_callback` to `Future` object, removes `_waiters` attribute, and re-implements `wait` and `as_completed` using callbacks.
This makes it possible to extend or replace `Future` without having to mimic its private `_waiters` interface. Currently waiters and callbacks are triggered at different points after a cancel (waiters in `set_condition_and_notify_cancel` and callbacks in `cancel`.) This is a problem as it means that implementing `wait` and `as_completed` using `add_done_callback` will result in a behaviour change unless the behaviour of `add_done_callback` is changed instead. I don't believe the current behaviour is as documented anyway so I'm not sure if this is a problem. See issue 22630. I am a little uncertain about the O(n) implementation of `remove_done_callback` but can't imagine a situation where it would be a problem. ---------- components: Library (Lib) files: non-magic-waiters.patch keywords: patch messages: 230016 nosy: bwhmather priority: normal severity: normal status: open title: `wait` and `as_completed` depend on private api type: behavior versions: Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file37016/non-magic-waiters.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22729> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com