aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2018-04-16 23:20:45 -0700
committerZac Medico <zmedico@gentoo.org>2018-04-16 23:20:45 -0700
commit0f8e3cd3cc695e721a8b1f7cfc56c53aca19fe4d (patch)
tree91a4ba19301bc34e59c23eb5ceffd9ca35455566
parentUse asyncio shim for TimeoutError and other exceptions (diff)
downloadportage-0f8e3cd3.tar.gz
portage-0f8e3cd3.tar.bz2
portage-0f8e3cd3.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)
-rw-r--r--pym/portage/util/_eventloop/EventLoop.py7
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):