diff options
author | Zac Medico <zmedico@gentoo.org> | 2018-04-16 23:20:45 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2018-04-16 23:20:45 -0700 |
commit | 0f8e3cd3cc695e721a8b1f7cfc56c53aca19fe4d (patch) | |
tree | 91a4ba19301bc34e59c23eb5ceffd9ca35455566 /pym/portage/util/_eventloop/EventLoop.py | |
parent | Use asyncio shim for TimeoutError and other exceptions (diff) | |
download | portage-0f8e3cd3cc695e721a8b1f7cfc56c53aca19fe4d.tar.gz portage-0f8e3cd3cc695e721a8b1f7cfc56c53aca19fe4d.tar.bz2 portage-0f8e3cd3cc695e721a8b1f7cfc56c53aca19fe4d.zip |
EventLoop._run_idle_callbacks: make recursive callbacks fatal
The caller should use call_soon in order to prevent recursion
here. Raise an error because recursive calls would make the
remaining count for this loop meaningless.
Fixes: 9772f8f2a58a (EventLoop._idle_add: use thread-safe deque append)
Diffstat (limited to 'pym/portage/util/_eventloop/EventLoop.py')
-rw-r--r-- | pym/portage/util/_eventloop/EventLoop.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pym/portage/util/_eventloop/EventLoop.py b/pym/portage/util/_eventloop/EventLoop.py index d4f20c6ed..c38a4defd 100644 --- a/pym/portage/util/_eventloop/EventLoop.py +++ b/pym/portage/util/_eventloop/EventLoop.py @@ -546,8 +546,11 @@ class EventLoop(object): # it got cancelled while executing another callback continue if x._calling: - # don't call it recursively - continue + # The caller should use call_soon in order to prevent + # recursion here. Raise an error because recursive + # calls would make the remaining count for this loop + # meaningless. + raise AssertionError('recursive idle callback') x._calling = True try: if x._callback(*x._args): |