From: homm Date: Sun, 28 Apr 2013 19:25:28 +0000 (+0400) Subject: Avoid circular references in StackContext and ExceptionStackContext. X-Git-Tag: v3.1.0~95^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1cc3c99e4e8d1bdb936dbbcc6cb963d6bef2e1e;p=thirdparty%2Ftornado.git Avoid circular references in StackContext and ExceptionStackContext. --- diff --git a/tornado/stack_context.py b/tornado/stack_context.py index 8804d42d8..ec94a1b8e 100644 --- a/tornado/stack_context.py +++ b/tornado/stack_context.py @@ -151,6 +151,9 @@ class StackContext(object): 'stack_context inconsistency (may be caused by yield ' 'within a "with StackContext" block)') + # Break up a reference to itself to allow for faster GC on CPython. + self.new_contexts = None + class ExceptionStackContext(object): """Specialization of StackContext for exception handling. @@ -190,6 +193,9 @@ class ExceptionStackContext(object): 'stack_context inconsistency (may be caused by yield ' 'within a "with StackContext" block)') + # Break up a reference to itself to allow for faster GC on CPython. + self.new_contexts = None + class NullContext(object): """Resets the `StackContext`.