]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
cleanups for python3
authorAlexander <homm86@gmail.com>
Fri, 27 Jan 2017 01:07:35 +0000 (04:07 +0300)
committerAlexander <homm86@gmail.com>
Fri, 27 Jan 2017 01:10:11 +0000 (04:10 +0300)
tornado/concurrent.py
tornado/gen.py
tornado/http1connection.py
tornado/util.py

index 05205f7374c7eb826b42245a3f03679e288c51d9..e571a2dcb09e34df8a682644194d3cd23741bd60 100644 (file)
@@ -234,7 +234,10 @@ class Future(object):
         if self._result is not None:
             return self._result
         if self._exc_info is not None:
-            raise_exc_info(self._exc_info)
+            try:
+                raise_exc_info(self._exc_info)
+            finally:
+                self = None
         self._check_done()
         return self._result
 
index ec10c6ff35705a4af8b20b8f2aca872d0e79fe21..14798ae2f1093e12d21caa095893cfc31e2f49d2 100644 (file)
@@ -295,6 +295,7 @@ def _make_coroutine_wrapper(func, replace_callback):
                     future.set_exc_info(sys.exc_info())
                 else:
                     Runner(result, future, yielded)
+                yielded = None
                 try:
                     return future
                 finally:
@@ -1017,6 +1018,7 @@ class Runner(object):
                     except Exception:
                         self.had_exception = True
                         exc_info = sys.exc_info()
+                    future = None
 
                     if exc_info is not None:
                         try:
@@ -1057,6 +1059,7 @@ class Runner(object):
                     return
                 if not self.handle_yield(yielded):
                     return
+                yielded = None
         finally:
             self.running = False
 
@@ -1105,8 +1108,11 @@ class Runner(object):
                 self.future.set_exc_info(sys.exc_info())
 
         if not self.future.done() or self.future is moment:
+            def inner(f):
+                f = None
+                self.run()
             self.io_loop.add_future(
-                self.future, lambda f: self.run())
+                self.future, inner)
             return False
         return True
 
index d0e91b82766259b0c5c003dff523f8ffb3e90636..d4f99c1cfb56c989ccc0f161e6f36b3a88b02c01 100644 (file)
@@ -257,6 +257,7 @@ class HTTP1Connection(httputil.HTTPConnection):
             if need_delegate_close:
                 with _ExceptionLoggingContext(app_log):
                     delegate.on_connection_close()
+            header_future = None
             self._clear_callbacks()
         raise gen.Return(True)
 
index 53584f98b4282900ab8363d7cb033f5f84bed3f3..de0b2e5b0c9d99b7c6e8ea700560bea4f1f3900a 100644 (file)
@@ -171,7 +171,10 @@ def exec_in(code, glob, loc=None):
 if PY3:
     exec("""
 def raise_exc_info(exc_info):
-    raise exc_info[1].with_traceback(exc_info[2])
+    try:
+        raise exc_info[1].with_traceback(exc_info[2])
+    finally:
+        exc_info = None
 
 def exec_in(code, glob, loc=None):
     if isinstance(code, str):