summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-06-22 22:03:43 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-06-22 22:03:43 (GMT)
commitd6de5d8455ac0d120d9c49d04f350433a86ec4e6 (patch)
tree36bbdd73e225b5f83ebf406584edc8c994049991 /Lib/asyncio
parentcd95e18bf7db348060ab9680729927b5ccb11bb1 (diff)
downloadcpython-d6de5d8455ac0d120d9c49d04f350433a86ec4e6.zip
cpython-d6de5d8455ac0d120d9c49d04f350433a86ec4e6.tar.gz
cpython-d6de5d8455ac0d120d9c49d04f350433a86ec4e6.tar.bz2
asyncio: BaseEventLoop._assert_is_current_event_loop() now only raises an
exception if the current loop is not None. Guido van Rossum wrote: "The behavior that you can set the loop to None (and keep track of it explicitly) is part of the spec, and this should still be supported even in debug mode. The behavior that we raise an error if you are caught having multiple active loops per thread is just a debugging heuristic, and it shouldn't break code that follows the spec."
Diffstat (limited to 'Lib/asyncio')
-rw-r--r--Lib/asyncio/base_events.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
index 9f9067e..2227a26 100644
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -327,7 +327,8 @@ class BaseEventLoop(events.AbstractEventLoop):
Should only be called when (self._debug == True). The caller is
responsible for checking this condition for performance reasons.
"""
- if events.get_event_loop() is not self:
+ current = events.get_event_loop()
+ if current is not None and current is not self:
raise RuntimeError(
"non-threadsafe operation invoked on an event loop other "
"than the current one")