]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
concurrent: Fix importability of tornado.wsgi on app engine
authorBen Darnell <ben@bendarnell.com>
Mon, 22 Jan 2018 01:12:06 +0000 (20:12 -0500)
committerBen Darnell <ben@bendarnell.com>
Fri, 26 Jan 2018 23:00:57 +0000 (18:00 -0500)
tornado/concurrent.py

index cca6468c4110bf20804a47c8b18fc87290614fd7..65da0ac83faa473fa078a0c5a882f7a72623b45d 100644 (file)
@@ -337,11 +337,12 @@ class Future(object):
 
     def _set_done(self):
         self._done = True
-        from tornado.ioloop import IOLoop
-        loop = IOLoop.current()
-        for cb in self._callbacks:
-            loop.add_callback(cb, self)
-        self._callbacks = None
+        if self._callbacks:
+            from tornado.ioloop import IOLoop
+            loop = IOLoop.current()
+            for cb in self._callbacks:
+                loop.add_callback(cb, self)
+            self._callbacks = None
 
     # On Python 3.3 or older, objects with a destructor part of a reference
     # cycle are never destroyed. It's no longer the case on Python 3.4 thanks to