From: Ben Darnell Date: Mon, 22 Jan 2018 01:12:06 +0000 (-0500) Subject: concurrent: Fix importability of tornado.wsgi on app engine X-Git-Tag: v5.0.0~13^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e8a137e6824716531d749bce8a18a1f229ed873;p=thirdparty%2Ftornado.git concurrent: Fix importability of tornado.wsgi on app engine --- diff --git a/tornado/concurrent.py b/tornado/concurrent.py index cca6468c4..65da0ac83 100644 --- a/tornado/concurrent.py +++ b/tornado/concurrent.py @@ -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