summaryrefslogtreecommitdiff
path: root/asyncio/tasks.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-02-19 23:07:08 +0100
committerVictor Stinner <victor.stinner@gmail.com>2014-02-19 23:07:08 +0100
commit4701782cbb133d6c07ceacdd8d1158d75166b0cb (patch)
tree29f556ca289e2a07773d0cc2839eb4d694d32885 /asyncio/tasks.py
parent4aeb56a672a028e4b5216301d90a6ce928dccb94 (diff)
downloadtrollius-4701782cbb133d6c07ceacdd8d1158d75166b0cb.tar.gz
Issue #136: Add get/set_debug() methods to BaseEventLoopTests. Add also a
PYTHONASYNCIODEBUG environment variable to debug coroutines since Python startup, to be able to debug coroutines defined directly in the asyncio module.
Diffstat (limited to 'asyncio/tasks.py')
-rw-r--r--asyncio/tasks.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/asyncio/tasks.py b/asyncio/tasks.py
index a3e7cdf..cf7b540 100644
--- a/asyncio/tasks.py
+++ b/asyncio/tasks.py
@@ -12,6 +12,8 @@ import concurrent.futures
import functools
import inspect
import linecache
+import os
+import sys
import traceback
import weakref
@@ -28,7 +30,8 @@ from .log import logger
# before you define your coroutines. A downside of using this feature
# is that tracebacks show entries for the CoroWrapper.__next__ method
# when _DEBUG is true.
-_DEBUG = False
+_DEBUG = (not sys.flags.ignore_environment
+ and bool(os.environ.get('PYTHONASYNCIODEBUG')))
class CoroWrapper: