Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/util/_eventloop/
Date: Sun, 08 Apr 2018 21:18:26
Message-Id: 1523222139.13621b62e32a7c21aa08247b33f1faa0a146d0d4.zmedico@gentoo
1 commit: 13621b62e32a7c21aa08247b33f1faa0a146d0d4
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Sun Apr 8 21:15:39 2018 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Sun Apr 8 21:15:39 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=13621b62
7
8 EventLoop: add get/set_debug methods for asyncio compat (bug 591760)
9
10 Bug: https://bugs.gentoo.org/591760
11
12 pym/portage/util/_eventloop/EventLoop.py | 14 ++++++++++++++
13 1 file changed, 14 insertions(+)
14
15 diff --git a/pym/portage/util/_eventloop/EventLoop.py b/pym/portage/util/_eventloop/EventLoop.py
16 index 1574a6837..4ec67241f 100644
17 --- a/pym/portage/util/_eventloop/EventLoop.py
18 +++ b/pym/portage/util/_eventloop/EventLoop.py
19 @@ -102,6 +102,7 @@ class EventLoop(object):
20 @type main: bool
21 """
22 self._use_signal = main and fcntl is not None
23 + self._debug = bool(os.environ.get('PYTHONASYNCIODEBUG'))
24 self._thread_rlock = threading.RLock()
25 self._thread_condition = threading.Condition(self._thread_rlock)
26 self._poll_event_queue = []
27 @@ -763,6 +764,19 @@ class EventLoop(object):
28 close()
29 self._poll_obj = None
30
31 + def get_debug(self):
32 + """
33 + Get the debug mode (bool) of the event loop.
34 +
35 + The default value is True if the environment variable
36 + PYTHONASYNCIODEBUG is set to a non-empty string, False otherwise.
37 + """
38 + return self._debug
39 +
40 + def set_debug(self, enabled):
41 + """Set the debug mode of the event loop."""
42 + self._debug = enabled
43 +
44
45 _can_poll_device = None