]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Avoid circular references in StackContext and ExceptionStackContext.
authorhomm <homm86@gmail.com>
Sun, 28 Apr 2013 19:25:28 +0000 (23:25 +0400)
committerhomm <homm86@gmail.com>
Sun, 28 Apr 2013 19:25:28 +0000 (23:25 +0400)
tornado/stack_context.py

index 8804d42d88a096a591ff8e3d9e9aa3e6c888fa49..ec94a1b8e1ae6c735f93aeeca3bbf715d10bbdff 100644 (file)
@@ -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`.