From: Serge S. Koval Date: Sat, 13 Apr 2013 21:02:49 +0000 (+0300) Subject: Don't use range for performance reasons X-Git-Tag: v3.1.0~121^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78d9cc6519f2894783b3409ca67360173e8a26fa;p=thirdparty%2Ftornado.git Don't use range for performance reasons --- diff --git a/tornado/stack_context.py b/tornado/stack_context.py index 64c815f0e..8804d42d8 100644 --- a/tornado/stack_context.py +++ b/tornado/stack_context.py @@ -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)