summaryrefslogtreecommitdiff
path: root/lib/yaml/emitter.py
diff options
context:
space:
mode:
authorxi <xi@18f92427-320e-0410-9341-c67f048884a3>2011-05-30 02:51:30 +0000
committerxi <xi@18f92427-320e-0410-9341-c67f048884a3>2011-05-30 02:51:30 +0000
commit428faafc50d046470da82af48fd3cf9a9854b088 (patch)
treeeb086caaf462460ed465e27830c6429f9dd33571 /lib/yaml/emitter.py
parentc30f23e669b9938520fce404d3ad7ffb2e7259f9 (diff)
downloadpyyaml-428faafc50d046470da82af48fd3cf9a9854b088.tar.gz
Clear cyclic references in the parser and the emitter to avoid extra GC calls.
git-svn-id: http://svn.pyyaml.org/pyyaml/trunk@377 18f92427-320e-0410-9341-c67f048884a3
Diffstat (limited to 'lib/yaml/emitter.py')
-rw-r--r--lib/yaml/emitter.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/yaml/emitter.py b/lib/yaml/emitter.py
index 4cb2c8a..e5bcdcc 100644
--- a/lib/yaml/emitter.py
+++ b/lib/yaml/emitter.py
@@ -103,6 +103,11 @@ class Emitter(object):
self.analysis = None
self.style = None
+ def dispose(self):
+ # Reset the state attributes (to clear self-references)
+ self.states = []
+ self.state = None
+
def emit(self, event):
self.events.append(event)
while not self.need_more_events():