diff options
author | Zac Medico <zmedico@gentoo.org> | 2018-04-17 10:57:04 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2018-04-17 10:59:10 -0700 |
commit | 0f7c9a73a805af5ec70da587b3c7d7f59dabe5ce (patch) | |
tree | 54fbb3b95ba00085b56b4290526685b29dc8bebe | |
parent | Add async_iter_completed for asyncio migration (bug 591760) (diff) | |
download | portage-0f7c9a73a805af5ec70da587b3c7d7f59dabe5ce.tar.gz portage-0f7c9a73a805af5ec70da587b3c7d7f59dabe5ce.tar.bz2 portage-0f7c9a73a805af5ec70da587b3c7d7f59dabe5ce.zip |
EventLoop._run_idle_callbacks: remove recursion check
This recursion check does not really work because callbacks are
removed from self._idle_callbacks before recursion would occur.
Fixes: 9772f8f2a58a (EventLoop._idle_add: use thread-safe deque append)
-rw-r--r-- | pym/portage/util/_eventloop/EventLoop.py | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/pym/portage/util/_eventloop/EventLoop.py b/pym/portage/util/_eventloop/EventLoop.py index c38a4defd..a61a3d74a 100644 --- a/pym/portage/util/_eventloop/EventLoop.py +++ b/pym/portage/util/_eventloop/EventLoop.py @@ -55,7 +55,7 @@ class EventLoop(object): __slots__ = ("callback", "data", "pid", "source_id") class _idle_callback_class(SlotObject): - __slots__ = ("_args", "_callback", "_calling", "_cancelled") + __slots__ = ("_args", "_callback", "_cancelled") class _io_handler_class(SlotObject): __slots__ = ("args", "callback", "f", "source_id") @@ -545,21 +545,11 @@ class EventLoop(object): if x._cancelled: # it got cancelled while executing another callback continue - if x._calling: - # 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): - reschedule.append(x) - else: - x._cancelled = True - state_change += 1 - finally: - x._calling = False + if x._callback(*x._args): + reschedule.append(x) + else: + x._cancelled = True + state_change += 1 finally: # Reschedule those that were not cancelled. self._idle_callbacks.extend(reschedule) |