concurrent: Fix importability of tornado.wsgi on app engine

This commit is contained in:
Ben Darnell 2018-01-21 20:12:06 -05:00
parent 606f0b5e90
commit 6e8a137e68
1 changed files with 6 additions and 5 deletions

View 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