commit: 0f8e3cd3cc695e721a8b1f7cfc56c53aca19fe4d
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 17 06:20:45 2018 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Apr 17 06:20:45 2018 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=0f8e3cd3
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)
pym/portage/util/_eventloop/EventLoop.py | 7 +++++--
1 file 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):