Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 528560 Details for
Bug 653856
sys-apps/portage: eliminate EventLoop.iteration() calls for asyncio compat
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
AsynchronousTask: disable event loop recursion
0001-AsynchronousTask-disable-event-loop-recursion-bug-65.patch (text/plain), 2.04 KB, created by
Zac Medico
on 2018-04-26 10:01:33 UTC
(
hide
)
Description:
AsynchronousTask: disable event loop recursion
Filename:
MIME Type:
Creator:
Zac Medico
Created:
2018-04-26 10:01:33 UTC
Size:
2.04 KB
patch
obsolete
>From 3bd2154ced96d5e4f0214d47fc8f981b7a55fb26 Mon Sep 17 00:00:00 2001 >From: Zac Medico <zmedico@gentoo.org> >Date: Thu, 26 Apr 2018 02:51:43 -0700 >Subject: [PATCH] AsynchronousTask: disable event loop recursion (bug 653856) > >Make the wait() and _async_wait() methods raise InvalidStateError >when the event loop is running and the returncode is not available, >since these cases would trigger event loop recursion. > >Bug: https://bugs.gentoo.org/653856 >--- > pym/_emerge/AsynchronousTask.py | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > >diff --git a/pym/_emerge/AsynchronousTask.py b/pym/_emerge/AsynchronousTask.py >index 7d2e6253b..5cc6d3b7d 100644 >--- a/pym/_emerge/AsynchronousTask.py >+++ b/pym/_emerge/AsynchronousTask.py >@@ -4,6 +4,7 @@ > import signal > > from portage import os >+from portage.util.futures import asyncio > from portage.util.SlotObject import SlotObject > > class AsynchronousTask(SlotObject): >@@ -17,8 +18,7 @@ class AsynchronousTask(SlotObject): > """ > > __slots__ = ("background", "cancelled", "returncode", "scheduler") + \ >- ("_exit_listeners", "_exit_listener_stack", "_start_listeners", >- "_waiting") >+ ("_exit_listeners", "_exit_listener_stack", "_start_listeners") > > _cancelled_returncode = - signal.SIGINT > >@@ -71,12 +71,9 @@ class AsynchronousTask(SlotObject): > Deprecated. Use async_wait() instead. > """ > if self.returncode is None: >- if not self._waiting: >- self._waiting = True >- try: >- self._wait() >- finally: >- self._waiting = False >+ if self.scheduler.is_running(): >+ raise asyncio.InvalidStateError('Result is not ready.') >+ self.scheduler.run_until_complete(self.async_wait()) > self._wait_hook() > return self.returncode > >@@ -91,6 +88,8 @@ class AsynchronousTask(SlotObject): > loop recursion (or stack overflow) that synchronous calling of > exit listeners can cause. This method is thread-safe. > """ >+ if self.returncode is None: >+ raise asyncio.InvalidStateError('Result is not ready.') > self.scheduler.idle_add(self._async_wait_cb) > > def _async_wait_cb(self): >-- >2.13.6 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 653856
:
528560