diff options
author | xi <xi@18f92427-320e-0410-9341-c67f048884a3> | 2011-05-30 03:29:16 +0000 |
---|---|---|
committer | xi <xi@18f92427-320e-0410-9341-c67f048884a3> | 2011-05-30 03:29:16 +0000 |
commit | 70e0f4f8da14c775de4a400546999b0f566046e6 (patch) | |
tree | 81f5790cae74db156215ba89abc04de0079a25f3 | |
parent | c30f23e669b9938520fce404d3ad7ffb2e7259f9 (diff) | |
download | pyyaml-70e0f4f8da14c775de4a400546999b0f566046e6.tar.gz |
Tagged PyYAML-3.10
git-svn-id: http://svn.pyyaml.org/pyyaml/tags/3.10@379 18f92427-320e-0410-9341-c67f048884a3
-rw-r--r-- | CHANGES | 7 | ||||
-rw-r--r-- | announcement.msg | 42 | ||||
-rw-r--r-- | ext/_yaml.pyx | 6 | ||||
-rw-r--r-- | lib/yaml/__init__.py | 69 | ||||
-rw-r--r-- | lib/yaml/constructor.py | 4 | ||||
-rw-r--r-- | lib/yaml/emitter.py | 5 | ||||
-rw-r--r-- | lib/yaml/parser.py | 5 | ||||
-rw-r--r-- | lib3/yaml/__init__.py | 69 | ||||
-rw-r--r-- | lib3/yaml/constructor.py | 4 | ||||
-rw-r--r-- | lib3/yaml/emitter.py | 5 | ||||
-rw-r--r-- | lib3/yaml/parser.py | 5 | ||||
-rw-r--r-- | setup.cfg | 14 | ||||
-rw-r--r-- | setup.py | 4 | ||||
-rw-r--r-- | tests/lib/canonical.py | 3 | ||||
-rw-r--r-- | tests/lib3/canonical.py | 3 |
15 files changed, 166 insertions, 79 deletions
@@ -1,6 +1,13 @@ For a complete Subversion changelog, see 'http://pyyaml.org/log/pyyaml'. +3.10 (2011-05-30) +----------------- + +* Do not try to build LibYAML bindings on platforms other than CPython + (Thank to olt(at)bogosoft(dot)com). +* Clear cyclic references in the parser and the emitter + (Thank to kristjan(at)ccpgames(dot)com). 3.09 (2009-08-31) ----------------- diff --git a/announcement.msg b/announcement.msg index 2e37c27..8cb814c 100644 --- a/announcement.msg +++ b/announcement.msg @@ -1,33 +1,24 @@ -From: Kirill Simonov <xi@gamma.dn.ua> +From: Kirill Simonov <xi@resolvent.net> To: python-list@python.org, python-announce@python.org, yaml-core@lists.sourceforge.net -Subject: [ANN] PyYAML-3.09: YAML parser and emitter for Python +Subject: [ANN] PyYAML-3.10: YAML parser and emitter for Python ======================== - Announcing PyYAML-3.09 + Announcing PyYAML-3.10 ======================== A new bug fix release of PyYAML is now available: http://pyyaml.org/wiki/PyYAML -Note that PyYAML supports both Python 2 and Python 3. For -compatibility notes, please see - - http://pyyaml.org/wiki/PyYAMLDocumentation#Python3support - Changes ======= -* Fixed use of uninitialized memory when emitting anchors with - LibYAML bindings (Thank to cegner(at)yahoo-inc(dot)com). -* Fixed emitting incorrect BOM characters for UTF-16 (Thank to - Valentin Nechayev) -* Fixed the emitter for folded scalars not respecting the preferred - line width (Thank to Ingy). -* Fixed a subtle ordering issue with emitting '%TAG' directives - (Thank to Andrey Somov). -* Fixed performance regression with LibYAML bindings. +* Do not try to build LibYAML bindings on platforms other than CPython; + this fixed installation under Jython (Thank to olt(at)bogosoft(dot)com). +* Clear cyclic references in the parser and the emitter + (Thank to kristjan(at)ccpgames(dot)com). +* LibYAML bindings are rebuilt with the latest version of Cython. Resources @@ -36,15 +27,16 @@ Resources PyYAML homepage: http://pyyaml.org/wiki/PyYAML PyYAML documentation: http://pyyaml.org/wiki/PyYAMLDocumentation -TAR.GZ package: http://pyyaml.org/download/pyyaml/PyYAML-3.09.tar.gz -ZIP package: http://pyyaml.org/download/pyyaml/PyYAML-3.09.zip +TAR.GZ package: http://pyyaml.org/download/pyyaml/PyYAML-3.10.tar.gz +ZIP package: http://pyyaml.org/download/pyyaml/PyYAML-3.10.zip Windows installers: - http://pyyaml.org/download/pyyaml/PyYAML-3.09.win32-py2.3.exe - http://pyyaml.org/download/pyyaml/PyYAML-3.09.win32-py2.4.exe - http://pyyaml.org/download/pyyaml/PyYAML-3.09.win32-py2.5.exe - http://pyyaml.org/download/pyyaml/PyYAML-3.09.win32-py2.6.exe - http://pyyaml.org/download/pyyaml/PyYAML-3.09.win32-py3.0.exe - http://pyyaml.org/download/pyyaml/PyYAML-3.09.win32-py3.1.exe + http://pyyaml.org/download/pyyaml/PyYAML-3.10.win32-py2.3.exe + http://pyyaml.org/download/pyyaml/PyYAML-3.10.win32-py2.4.exe + http://pyyaml.org/download/pyyaml/PyYAML-3.10.win32-py2.5.exe + http://pyyaml.org/download/pyyaml/PyYAML-3.10.win32-py2.6.exe + http://pyyaml.org/download/pyyaml/PyYAML-3.10.win32-py3.0.exe + http://pyyaml.org/download/pyyaml/PyYAML-3.10.win32-py3.1.exe + http://pyyaml.org/download/pyyaml/PyYAML-3.10.win32-py3.2.exe PyYAML SVN repository: http://svn.pyyaml.org/pyyaml Submit a bug report: http://pyyaml.org/newticket?component=pyyaml diff --git a/ext/_yaml.pyx b/ext/_yaml.pyx index df19492..5158fb4 100644 --- a/ext/_yaml.pyx +++ b/ext/_yaml.pyx @@ -311,6 +311,9 @@ cdef class CParser: yaml_parser_delete(&self.parser) yaml_event_delete(&self.parsed_event) + def dispose(self): + pass + cdef object _parser_error(self): if self.parser.error == YAML_MEMORY_ERROR: return MemoryError @@ -993,6 +996,9 @@ cdef class CEmitter: def __dealloc__(self): yaml_emitter_delete(&self.emitter) + def dispose(self): + pass + cdef object _emitter_error(self): if self.emitter.error == YAML_MEMORY_ERROR: return MemoryError diff --git a/lib/yaml/__init__.py b/lib/yaml/__init__.py index c0fd1f3..f977f46 100644 --- a/lib/yaml/__init__.py +++ b/lib/yaml/__init__.py @@ -8,7 +8,7 @@ from nodes import * from loader import * from dumper import * -__version__ = '3.09' +__version__ = '3.10' try: from cyaml import * @@ -21,16 +21,22 @@ def scan(stream, Loader=Loader): Scan a YAML stream and produce scanning tokens. """ loader = Loader(stream) - while loader.check_token(): - yield loader.get_token() + try: + while loader.check_token(): + yield loader.get_token() + finally: + loader.dispose() def parse(stream, Loader=Loader): """ Parse a YAML stream and produce parsing events. """ loader = Loader(stream) - while loader.check_event(): - yield loader.get_event() + try: + while loader.check_event(): + yield loader.get_event() + finally: + loader.dispose() def compose(stream, Loader=Loader): """ @@ -38,7 +44,10 @@ def compose(stream, Loader=Loader): and produce the corresponding representation tree. """ loader = Loader(stream) - return loader.get_single_node() + try: + return loader.get_single_node() + finally: + loader.dispose() def compose_all(stream, Loader=Loader): """ @@ -46,8 +55,11 @@ def compose_all(stream, Loader=Loader): and produce corresponding representation trees. """ loader = Loader(stream) - while loader.check_node(): - yield loader.get_node() + try: + while loader.check_node(): + yield loader.get_node() + finally: + loader.dispose() def load(stream, Loader=Loader): """ @@ -55,7 +67,10 @@ def load(stream, Loader=Loader): and produce the corresponding Python object. """ loader = Loader(stream) - return loader.get_single_data() + try: + return loader.get_single_data() + finally: + loader.dispose() def load_all(stream, Loader=Loader): """ @@ -63,8 +78,11 @@ def load_all(stream, Loader=Loader): and produce corresponding Python objects. """ loader = Loader(stream) - while loader.check_data(): - yield loader.get_data() + try: + while loader.check_data(): + yield loader.get_data() + finally: + loader.dispose() def safe_load(stream): """ @@ -96,8 +114,11 @@ def emit(events, stream=None, Dumper=Dumper, getvalue = stream.getvalue dumper = Dumper(stream, canonical=canonical, indent=indent, width=width, allow_unicode=allow_unicode, line_break=line_break) - for event in events: - dumper.emit(event) + try: + for event in events: + dumper.emit(event) + finally: + dumper.dispose() if getvalue: return getvalue() @@ -122,10 +143,13 @@ def serialize_all(nodes, stream=None, Dumper=Dumper, allow_unicode=allow_unicode, line_break=line_break, encoding=encoding, version=version, tags=tags, explicit_start=explicit_start, explicit_end=explicit_end) - dumper.open() - for node in nodes: - dumper.serialize(node) - dumper.close() + try: + dumper.open() + for node in nodes: + dumper.serialize(node) + dumper.close() + finally: + dumper.dispose() if getvalue: return getvalue() @@ -160,10 +184,13 @@ def dump_all(documents, stream=None, Dumper=Dumper, allow_unicode=allow_unicode, line_break=line_break, encoding=encoding, version=version, tags=tags, explicit_start=explicit_start, explicit_end=explicit_end) - dumper.open() - for data in documents: - dumper.represent(data) - dumper.close() + try: + dumper.open() + for data in documents: + dumper.represent(data) + dumper.close() + finally: + dumper.dispose() if getvalue: return getvalue() diff --git a/lib/yaml/constructor.py b/lib/yaml/constructor.py index 420c434..081d78a 100644 --- a/lib/yaml/constructor.py +++ b/lib/yaml/constructor.py @@ -58,11 +58,11 @@ class BaseConstructor(object): return data def construct_object(self, node, deep=False): + if node in self.constructed_objects: + return self.constructed_objects[node] if deep: old_deep = self.deep_construct self.deep_construct = True - if node in self.constructed_objects: - return self.constructed_objects[node] if node in self.recursive_objects: raise ConstructorError(None, None, "found unconstructable recursive node", node.start_mark) 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(): diff --git a/lib/yaml/parser.py b/lib/yaml/parser.py index b6a7416..f9e3057 100644 --- a/lib/yaml/parser.py +++ b/lib/yaml/parser.py @@ -86,6 +86,11 @@ class Parser(object): 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: diff --git a/lib3/yaml/__init__.py b/lib3/yaml/__init__.py index cd2ea5a..0033d9c 100644 --- a/lib3/yaml/__init__.py +++ b/lib3/yaml/__init__.py @@ -8,7 +8,7 @@ from .nodes import * from .loader import * from .dumper import * -__version__ = '3.09' +__version__ = '3.10' try: from .cyaml import * __with_libyaml__ = True @@ -22,16 +22,22 @@ def scan(stream, Loader=Loader): Scan a YAML stream and produce scanning tokens. """ loader = Loader(stream) - while loader.check_token(): - yield loader.get_token() + try: + while loader.check_token(): + yield loader.get_token() + finally: + loader.dispose() def parse(stream, Loader=Loader): """ Parse a YAML stream and produce parsing events. """ loader = Loader(stream) - while loader.check_event(): - yield loader.get_event() + try: + while loader.check_event(): + yield loader.get_event() + finally: + loader.dispose() def compose(stream, Loader=Loader): """ @@ -39,7 +45,10 @@ def compose(stream, Loader=Loader): and produce the corresponding representation tree. """ loader = Loader(stream) - return loader.get_single_node() + try: + return loader.get_single_node() + finally: + loader.dispose() def compose_all(stream, Loader=Loader): """ @@ -47,8 +56,11 @@ def compose_all(stream, Loader=Loader): and produce corresponding representation trees. """ loader = Loader(stream) - while loader.check_node(): - yield loader.get_node() + try: + while loader.check_node(): + yield loader.get_node() + finally: + loader.dispose() def load(stream, Loader=Loader): """ @@ -56,7 +68,10 @@ def load(stream, Loader=Loader): and produce the corresponding Python object. """ loader = Loader(stream) - return loader.get_single_data() + try: + return loader.get_single_data() + finally: + loader.dispose() def load_all(stream, Loader=Loader): """ @@ -64,8 +79,11 @@ def load_all(stream, Loader=Loader): and produce corresponding Python objects. """ loader = Loader(stream) - while loader.check_data(): - yield loader.get_data() + try: + while loader.check_data(): + yield loader.get_data() + finally: + loader.dispose() def safe_load(stream): """ @@ -96,8 +114,11 @@ def emit(events, stream=None, Dumper=Dumper, getvalue = stream.getvalue dumper = Dumper(stream, canonical=canonical, indent=indent, width=width, allow_unicode=allow_unicode, line_break=line_break) - for event in events: - dumper.emit(event) + try: + for event in events: + dumper.emit(event) + finally: + dumper.dispose() if getvalue: return getvalue() @@ -121,10 +142,13 @@ def serialize_all(nodes, stream=None, Dumper=Dumper, allow_unicode=allow_unicode, line_break=line_break, encoding=encoding, version=version, tags=tags, explicit_start=explicit_start, explicit_end=explicit_end) - dumper.open() - for node in nodes: - dumper.serialize(node) - dumper.close() + try: + dumper.open() + for node in nodes: + dumper.serialize(node) + dumper.close() + finally: + dumper.dispose() if getvalue: return getvalue() @@ -158,10 +182,13 @@ def dump_all(documents, stream=None, Dumper=Dumper, allow_unicode=allow_unicode, line_break=line_break, encoding=encoding, version=version, tags=tags, explicit_start=explicit_start, explicit_end=explicit_end) - dumper.open() - for data in documents: - dumper.represent(data) - dumper.close() + try: + dumper.open() + for data in documents: + dumper.represent(data) + dumper.close() + finally: + dumper.dispose() if getvalue: return getvalue() diff --git a/lib3/yaml/constructor.py b/lib3/yaml/constructor.py index bd25b79..981543a 100644 --- a/lib3/yaml/constructor.py +++ b/lib3/yaml/constructor.py @@ -51,11 +51,11 @@ class BaseConstructor: return data def construct_object(self, node, deep=False): + if node in self.constructed_objects: + return self.constructed_objects[node] if deep: old_deep = self.deep_construct self.deep_construct = True - if node in self.constructed_objects: - return self.constructed_objects[node] if node in self.recursive_objects: raise ConstructorError(None, None, "found unconstructable recursive node", node.start_mark) diff --git a/lib3/yaml/emitter.py b/lib3/yaml/emitter.py index 8947d04..34cb145 100644 --- a/lib3/yaml/emitter.py +++ b/lib3/yaml/emitter.py @@ -103,6 +103,11 @@ class Emitter: 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(): 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: @@ -17,19 +17,19 @@ # The following options are used to build PyYAML Windows installer # for Python 2.3 on my PC: -#include_dirs=../../../libyaml/tags/0.1.3/include -#library_dirs=../../../libyaml/tags/0.1.3/win32/vc6/output/release/lib +#include_dirs=../../../libyaml/tags/0.1.4/include +#library_dirs=../../../libyaml/tags/0.1.4/win32/vc6/output/release/lib #define=YAML_DECLARE_STATIC # The following options are used to build PyYAML Windows installer # for Python 2.4 and Python 2.5 on my PC: -#include_dirs=../../../libyaml/tags/0.1.3/include -#library_dirs=../../../libyaml/tags/0.1.3/win32/vs2003/output/release/lib +#include_dirs=../../../libyaml/tags/0.1.4/include +#library_dirs=../../../libyaml/tags/0.1.4/win32/vs2003/output/release/lib #define=YAML_DECLARE_STATIC # The following options are used to build PyYAML Windows installer -# for Python 2.6, Python 3.0 and Python 3.1 on my PC: -#include_dirs=../../../libyaml/tags/0.1.3/include -#library_dirs=../../../libyaml/tags/0.1.3/win32/vs2008/output/release/lib +# for Python 2.6, 2.7, 3.0, 3.1 and 3.2 on my PC: +#include_dirs=../../../libyaml/tags/0.1.4/include +#library_dirs=../../../libyaml/tags/0.1.4/win32/vs2008/output/release/lib #define=YAML_DECLARE_STATIC @@ -1,6 +1,6 @@ NAME = 'PyYAML' -VERSION = '3.09' +VERSION = '3.10' DESCRIPTION = "YAML parser and emitter for Python" LONG_DESCRIPTION = """\ YAML is a data serialization format designed for human readability @@ -31,9 +31,11 @@ CLASSIFIERS = [ "Programming Language :: Python :: 2.4", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.0", "Programming Language :: Python :: 3.1", + "Programming Language :: Python :: 3.2", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Text Processing :: Markup", ] diff --git a/tests/lib/canonical.py b/tests/lib/canonical.py index 41d111a..020e6db 100644 --- a/tests/lib/canonical.py +++ b/tests/lib/canonical.py @@ -211,6 +211,9 @@ class CanonicalParser: self.events = [] self.parsed = False + def dispose(self): + pass + # stream: STREAM-START document* STREAM-END def parse_stream(self): self.get_token(yaml.StreamStartToken) diff --git a/tests/lib3/canonical.py b/tests/lib3/canonical.py index e04477b..a8b4e3a 100644 --- a/tests/lib3/canonical.py +++ b/tests/lib3/canonical.py @@ -212,6 +212,9 @@ class CanonicalParser: self.events = [] self.parsed = False + def dispose(self): + pass + # stream: STREAM-START document* STREAM-END def parse_stream(self): self.get_token(yaml.StreamStartToken) |