[Python-checkins] cpython (3.4): asyncio: BaseEventLoop._assert_is_current_event_loop() now only raises an

victor.stinner python-checkins at python.org
Mon Jun 23 00:05:20 CEST 2014


http://hg.python.org/cpython/rev/4cd3e1f9c250
changeset: 91323:4cd3e1f9c250
branch: 3.4
parent: 91319:b896fe4b1201
user: Victor Stinner <victor.stinner at gmail.com>
date: Mon Jun 23 00:03:43 2014 +0200
summary:
 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."
files:
 Lib/asyncio/base_events.py | 3 ++-
 1 files changed, 2 insertions(+), 1 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
@@ -327,7 +327,8 @@
 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")
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /