summaryrefslogtreecommitdiff
path: root/lib3/yaml/parser.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 /lib3/yaml/parser.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 'lib3/yaml/parser.py')
-rw-r--r--lib3/yaml/parser.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib3/yaml/parser.py b/lib3/yaml/parser.py
index c147dd6..13a5995 100644
--- a/lib3/yaml/parser.py
+++ b/lib3/yaml/parser.py
@@ -86,6 +86,11 @@ class Parser:
self.marks = []
self.state = self.parse_stream_start
+ def dispose(self):
+ # Reset the state attributes (to clear self-references)
+ self.states = []
+ self.state = None
+
def check_event(self, *choices):
# Check the type of the next event.
if self.current_event is None: