]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Lazy-load StopAsyncIteration in a more future-proof way.
authorBen Darnell <ben@bendarnell.com>
Mon, 3 Aug 2015 03:56:22 +0000 (23:56 -0400)
committerBen Darnell <ben@bendarnell.com>
Mon, 3 Aug 2015 03:56:22 +0000 (23:56 -0400)
Fixes the test on nightly cpython.

tornado/gen.py

index 56c5f373703ea4255f147b82852abf757bd7708d..78ddce75c41c5e49e86524cbe694b685a4a69869 100644 (file)
@@ -108,6 +108,11 @@ try:
 except ImportError:
     def isawaitable(x): return False
 
+try:
+    import builtins  # py3
+except ImportError:
+    import __builtin__ as builtins
+
 
 class KeyReuseError(Exception):
     pass
@@ -412,7 +417,7 @@ class WaitIterator(object):
     def __anext__(self):
         if self.done():
             # Lookup by name to silence pyflakes on older versions.
-            raise globals()['StopAsyncIteration']()
+            raise getattr(builtins, 'StopAsyncIteration')()
         return self.next()