]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Don't use range for performance reasons
authorSerge S. Koval <serge.koval+github@gmail.com>
Sat, 13 Apr 2013 21:02:49 +0000 (00:02 +0300)
committerSerge S. Koval <serge.koval+github@gmail.com>
Sat, 13 Apr 2013 21:02:49 +0000 (00:02 +0300)
tornado/stack_context.py

index 64c815f0e6936ef839f78637c961bd91a144ed5f..8804d42d88a096a591ff8e3d9e9aa3e6c888fa49 100644 (file)
@@ -259,8 +259,9 @@ def wrap(fn):
                 exc = _handle_exception(top, exc)
             else:
                 # Otherwise take shorter path and run stack contexts in reverse order
-                for n in range(last_ctx - 1, -1, -1):
-                    c = stack[n]
+                while last_ctx > 0:
+                    last_ctx -= 1
+                    c = stack[last_ctx]
 
                     try:
                         c.exit(*exc)