[Python-checkins] cpython (merge 3.4 -> default): (Merge 3.4) asyncio, Tulip issue 172: only log selector timing in debug mode

victor.stinner python-checkins at python.org
Mon Jun 23 00:32:38 CEST 2014


http://hg.python.org/cpython/rev/188970f81ef8
changeset:   91330:188970f81ef8
parent:      91328:3e87fb8df9c3
parent:      91329:d855c034d7d5
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Mon Jun 23 00:31:31 2014 +0200
summary:
  (Merge 3.4) asyncio, Tulip issue 172: only log selector timing in debug mode

files:
  Lib/asyncio/base_events.py                |  3 +--
  Lib/test/test_asyncio/test_base_events.py |  3 +++
  2 files changed, 4 insertions(+), 2 deletions(-)


diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -834,8 +834,7 @@
             when = self._scheduled[0]._when
             timeout = max(0, when - self.time())
 
-        # TODO: Instrumentation only in debug mode?
-        if logger.isEnabledFor(logging.INFO):
+        if self._debug:
             t0 = self.time()
             event_list = self._selector.select(timeout)
             dt = self.time() - t0
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
@@ -247,6 +247,9 @@
             time.sleep(1.0)
             return []
 
+        # logging needs debug flag
+        self.loop.set_debug(True)
+
         # Log to INFO level if timeout > 1.0 sec.
         self.loop._selector.select = slow_select
         self.loop._process_events = mock.Mock()

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list