Commit fca6429d authored by Moritz Muehlenhoff's avatar Moritz Muehlenhoff

Imported Debian patch 3.10-4+deb7u1

parents ffff11dd 86822a65
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).
* Dropped support for Python 2.3 and 2.4.
3.09 (2009-08-31)
-----------------
......
Metadata-Version: 1.0
Name: PyYAML
Version: 3.09
Version: 3.10
Summary: YAML parser and emitter for Python
Home-page: http://pyyaml.org/wiki/PyYAML
Author: Kirill Simonov
Author-email: xi@resolvent.net
License: MIT
Download-URL: http://pyyaml.org/download/pyyaml/PyYAML-3.09.tar.gz
Download-URL: http://pyyaml.org/download/pyyaml/PyYAML-3.10.tar.gz
Description: YAML is a data serialization format designed for human readability
and interaction with scripting languages. PyYAML is a YAML parser
and emitter for Python.
......@@ -29,8 +29,10 @@ Classifier: Programming Language :: Python :: 2.3
Classifier: Programming Language :: Python :: 2.4
Classifier: Programming Language :: Python :: 2.5
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.0
Classifier: Programming Language :: Python :: 3.1
Classifier: Programming Language :: Python :: 3.2
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Markup
This package uses quilt to manage all modifications to the upstream
source. Changes are stored in the source package as diffs in
debian/patches and applied during the build.
To configure quilt to use debian/patches instead of patches, you want
either to export QUILT_PATCHES=debian/patches in your environment
or use this snippet in your ~/.quiltrc:
for where in ./ ../ ../../ ../../../ ../../../../ ../../../../../; do
if [ -e ${where}debian/rules -a -d ${where}debian/patches ]; then
export QUILT_PATCHES=debian/patches
break
fi
done
To get the fully patched source after unpacking the source package, cd to
the root level of the source package and run:
quilt push -a
The last patch listed in debian/patches/series will become the current
patch.
To add a new set of changes, first run quilt push -a, and then run:
quilt new <patch>
where <patch> is a descriptive name for the patch, used as the filename in
debian/patches. Then, for every file that will be modified by this patch,
run:
quilt add <file>
before editing those files. You must tell quilt with quilt add what files
will be part of the patch before making changes or quilt will not work
properly. After editing the files, run:
quilt refresh
to save the results as a patch.
Alternately, if you already have an external patch and you just want to
add it to the build system, run quilt push -a and then:
quilt import -P <patch> /path/to/patch
quilt push -a
(add -p 0 to quilt import if needed). <patch> as above is the filename to
use in debian/patches. The last quilt push -a will apply the patch to
make sure it works properly.
To remove an existing patch from the list of patches that will be applied,
run:
quilt delete <patch>
You may need to run quilt pop -a to unapply patches first before running
this command.
pyyaml (3.09-5+deb6u1) squeeze-lts; urgency=high
pyyaml (3.10-4+deb7u1) wheezy-security; urgency=medium
* Non-maintainer upload by the Squeeze LTS Team.
* Add CVE-2014-9130.patch.
CVE-2014-9130: assert failure when processing wrapped strings.
(Closes: #772815)
* CVE-2014-9130, patch by Thorsten Alteholz (Closes: #772815)
-- Thorsten Alteholz <debian@alteholz.de> Sat, 03 Jan 2015 16:00:21 +0100
-- Moritz Muehlenhoff <jmm@debian.org> Sun, 28 Dec 2014 23:35:53 +0100
pyyaml (3.10-4) unstable; urgency=low
* Bump debian/compat and minimum debhelper version to 9 for dpkg-buildflags
and hardening support
* Drop unneeded XB-Python-Version from python-yaml
-- Scott Kitterman <scott@kitterman.com> Tue, 26 Jun 2012 11:19:50 -0400
pyyaml (3.10-3) unstable; urgency=low
* Regenerate ext_yaml.c during build
- Update debian/rules to move the upstream file aside during build
- Add cython and cython-dbg to build-depends
* Add quilt patch system
- Add quilt to build-depends
- Add --with quilt to debian/rules
- Add README.source
* Add debian/patches/size_t_not_int.diff to fix FTBFS on S390x
(Closes: #676536)
- Thanks to Julien Cristau for the patch
* Rework debian/rules to support DEB_BUILD_OPTIONS nocheck
* Bump standards version to 3.9.3 without further change
-- Scott Kitterman <scott@kitterman.com> Fri, 08 Jun 2012 16:36:33 -0400
pyyaml (3.10-2) unstable; urgency=low
* Remove python3-yaml-dbg find rule in debian/rules so python3 debug package
is built correctly (Closes: #650950)
* Remove similar rule for python-yaml-dbg since it is not needed
* Fix short descriptions for debug packages so they are not the same as
non-debug packages
* Also ship upstream changelog in python-yaml
* Add python3-yaml.docs to README/CHANGES are shipped in python3-yaml
* Bump standards version to 3.9.2 without further change
-- Scott Kitterman <scott@kitterman.com> Sun, 04 Dec 2011 13:48:42 -0500
pyyaml (3.10-1) unstable; urgency=low
* New upstream release (LP: #770895)
* Override dh_auto_test to run tests in the right part of the build
* Protect for loops in debian/rules with set -e
* Use install-layout=deb to avoid files landing in /usr/local
* Drop XB-Python-Version from python-yaml (obsolete)
-- Scott Kitterman <scott@kitterman.com> Tue, 31 May 2011 16:18:44 -0400
pyyaml (3.09-5) unstable; urgency=low
......
......@@ -3,18 +3,17 @@ Section: python
Priority: optional
Maintainer: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>
Uploaders: Scott Kitterman <scott@kitterman.com>
Build-Depends: debhelper (>= 7.3.16), python-all-dev (>=2.6.5-13~), python-all-dbg, python3-all-dev (>= 3.1.2-10~), python3-all-dbg, libyaml-dev (>=0.1.2~)
Build-Depends: debhelper (>= 9), python-all-dev (>=2.6.5-13~), python-all-dbg, python3-all-dev (>= 3.1.2-10~), python3-all-dbg, libyaml-dev (>=0.1.2~), cython, cython-dbg, quilt
X-Python-Version: >= 2.4
X-Python3-Version: >= 3.0
Vcs-Svn: svn://svn.debian.org/python-modules/packages/pyyaml/trunk/
Vcs-Browser: http://svn.debian.org/viewsvn/python-modules/packages/pyyaml/trunk/
Standards-Version: 3.9.1
Standards-Version: 3.9.3
Homepage: http://pyyaml.org/
Package: python-yaml
Architecture: any
Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends}
XB-Python-Version: ${python:Versions}
Description: YAML parser and emitter for Python
Python-yaml is a complete YAML 1.1 parser and emitter for Python. It can parse
all examples from the specification. The parsing algorithm is simple enough to
......@@ -26,8 +25,7 @@ Section: debug
Priority: extra
Architecture: any
Depends: python-yaml (= ${binary:Version}), python-dbg, ${shlibs:Depends}, ${misc:Depends}
XB-Python-Version: ${python:Versions}
Description: YAML parser and emitter for Python
Description: YAML parser and emitter for Python (debug build)
Python-yaml is a complete YAML 1.1 parser and emitter for Python. It can parse
all examples from the specification. The parsing algorithm is simple enough to
be a reference for YAML parser implementors. A simple extension API is also
......@@ -41,18 +39,18 @@ Depends: ${python3:Depends}, ${shlibs:Depends}, ${misc:Depends}
Description: YAML parser and emitter for Python3
Python3-yaml is a complete YAML 1.1 parser and emitter for Python3. It can
parse all examples from the specification. The parsing algorithm is simple
enough to be a reference for YAML parser implementors. A simple extension API is
also provided. The package is built using libyaml for improved speed.
enough to be a reference for YAML parser implementors. A simple extension API
is also provided. The package is built using libyaml for improved speed.
Package: python3-yaml-dbg
Section: debug
Priority: extra
Architecture: any
Depends: python3-yaml (= ${binary:Version}), python3-dbg, ${shlibs:Depends}, ${misc:Depends}
Description: YAML parser and emitter for Python3
Description: YAML parser and emitter for Python3 (debug build)
Python3-yaml is a complete YAML 1.1 parser and emitter for Python3. It can
parse all examples from the specification. The parsing algorithm is simple
enough to be a reference for YAML parser implementors. A simple extension API is
also provided. The package is built using libyaml for improved speed.
enough to be a reference for YAML parser implementors. A simple extension API
is also provided. The package is built using libyaml for improved speed.
.
This package contains the extension built for the Python3 debug interpreter.
# HG changeset patch
# User Kirill Simonov <xi@resolvent.net>
# Date 1417197216 21600
# Node ID ddf211a41bb231c365fece5599b7e484e6dc33fc
# Parent 263dff6f9664ccdc532283ba5c7b282c0e436a7b
Removed invalid simple key assertion.
Index: pyyaml-3.10/lib/yaml/scanner.py
===================================================================
--- pyyaml-3.10.orig/lib/yaml/scanner.py 2014-12-22 17:28:25.000000000 +0100
+++ pyyaml-3.10/lib/yaml/scanner.py 2014-12-22 17:28:25.000000000 +0100
@@ -297,10 +297,6 @@
# Check if a simple key is required at the current position.
required = not self.flow_level and self.indent == self.column
- # A simple key is required only if it is the first token in the current
- # line. Therefore it is always allowed.
- assert self.allow_simple_key or not required
-
# The next token might be a simple key. Let's save it's number and
# position.
if self.allow_simple_key:
Index: pyyaml-3.10/lib3/yaml/scanner.py
===================================================================
--- pyyaml-3.10.orig/lib3/yaml/scanner.py 2014-12-22 17:28:25.000000000 +0100
+++ pyyaml-3.10/lib3/yaml/scanner.py 2014-12-22 17:28:25.000000000 +0100
@@ -297,10 +297,6 @@
# Check if a simple key is required at the current position.
required = not self.flow_level and self.indent == self.column
- # A simple key is required only if it is the first token in the current
- # line. Therefore it is always allowed.
- assert self.allow_simple_key or not required
-
# The next token might be a simple key. Let's save it's number and
# position.
if self.allow_simple_key:
size_t_not_int.diff
CVE-2014-9130.diff
pyyaml FTBFS on the s390x buildd. It seems this is due to using int
where the libyaml API uses size_t. I tested the attached patch in
zelenka.d.o's sid chroot, and at least the python2 build/test worked (it
failed with the same error as the buildd pre-patching).
Patch by Julien Cristau <jcristau@debian.org>
Add to the pyyaml package by Scott Kitterman <scott@kitterman.com>
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=676536
Index: pyyaml-3.10/ext/_yaml.pxd
===================================================================
--- pyyaml-3.10.orig/ext/_yaml.pxd 2011-05-29 23:31:01.000000000 -0400
+++ pyyaml-3.10/ext/_yaml.pxd 2012-06-08 16:33:54.309407701 -0400
@@ -86,15 +86,15 @@
YAML_MAPPING_END_EVENT
ctypedef int yaml_read_handler_t(void *data, char *buffer,
- int size, int *size_read) except 0
+ size_t size, size_t *size_read) except 0
ctypedef int yaml_write_handler_t(void *data, char *buffer,
- int size) except 0
+ size_t size) except 0
ctypedef struct yaml_mark_t:
- int index
- int line
- int column
+ size_t index
+ size_t line
+ size_t column
ctypedef struct yaml_version_directive_t:
int major
int minor
@@ -113,7 +113,7 @@
char *suffix
ctypedef struct _yaml_token_scalar_data_t:
char *value
- int length
+ size_t length
yaml_scalar_style_t style
ctypedef struct _yaml_token_version_directive_data_t:
int major
@@ -152,7 +152,7 @@
char *anchor
char *tag
char *value
- int length
+ size_t length
int plain_implicit
int quoted_implicit
yaml_scalar_style_t style
Index: pyyaml-3.10/ext/_yaml.pyx
===================================================================
--- pyyaml-3.10.orig/ext/_yaml.pyx 2011-05-29 23:31:01.000000000 -0400
+++ pyyaml-3.10/ext/_yaml.pyx 2012-06-08 16:33:54.313409701 -0400
@@ -905,7 +905,7 @@
raise error
return 1
-cdef int input_handler(void *data, char *buffer, int size, int *read) except 0:
+cdef int input_handler(void *data, char *buffer, size_t size, size_t *read) except 0:
cdef CParser parser
parser = <CParser>data
if parser.stream_cache is None:
@@ -1515,7 +1515,7 @@
self.ascend_resolver()
return 1
-cdef int output_handler(void *data, char *buffer, int size) except 0:
+cdef int output_handler(void *data, char *buffer, size_t size) except 0:
cdef CEmitter emitter
emitter = <CEmitter>data
if emitter.dump_unicode == 0:
......@@ -4,51 +4,77 @@ buildvers := $(shell pyversions -sv)
build3vers := $(shell py3versions -sv)
%:
dh $@ --with python2, --with python3
dh $@ --with python2, --with python3, --with quilt
override_dh_build:
dh_build
python setup.py test
python3 setup.py test
override_dh_auto_build:
override_dh_auto_install:
# Move generated _yaml.c aside so we can regenerate it during build
mv $(CURDIR)/ext/_yaml.c $(CURDIR)/upstream.yaml.c
override_dh_install:
dh_install -ppython-yaml
for i in $(buildvers); do \
python$$i ./setup.py install --root $(CURDIR)/debian/python-yaml; \
set -e && for i in $(buildvers); do \
python$$i ./setup.py install --install-layout=deb --root $(CURDIR)/debian/python-yaml; \
done
dh_install -ppython-yaml-dbg
for i in $(buildvers); do \
python$$i-dbg ./setup.py install --root $(CURDIR)/debian/python-yaml-dbg; \
set -e && for i in $(buildvers); do \
python$$i-dbg ./setup.py install --install-layout=deb --root $(CURDIR)/debian/python-yaml-dbg; \
done
find debian/python-yaml-dbg \
! -type d ! -name '*_d.so' | xargs rm -f
find debian/python-yaml-dbg -depth -empty -exec rmdir {} \;
dh_install -ppython3-yaml
for i in $(build3vers); do \
python$$i ./setup.py install --root $(CURDIR)/debian/python3-yaml; \
set -e && for i in $(build3vers); do \
python$$i ./setup.py install --install-layout=deb --root $(CURDIR)/debian/python3-yaml; \
done
dh_install -ppython3-yaml-dbg
for i in $(build3vers); do \
python$$i-dbg ./setup.py install --root $(CURDIR)/debian/python3-yaml-dbg; \
set -e && for i in $(build3vers); do \
python$$i-dbg ./setup.py install --install-layout=deb --root $(CURDIR)/debian/python3-yaml-dbg; \
done
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
set -e && for i in $(buildvers); do \
echo "-- running tests for "$$i" plain --" ; \
python$$i -c "import sys ; sys.path.insert(0, 'debian/python-yaml/usr/lib/python$$i/dist-packages/'); \
sys.path.insert(0, 'tests/lib'); import test_all; test_all.main([])";\
done
set -e && for i in $(buildvers); do \
echo "-- running tests for "$$i" debug --" ; \
python$$i-dbg -c "import sys ; sys.path.insert(0, 'debian/python-yaml-dbg/usr/lib/python$$i/dist-packages/'); \
sys.path.insert(0, 'tests/lib'); import test_all; test_all.main([])";\
done
find debian/python3-yaml-dbg \
! -type d ! -name '*_d.so' | xargs rm -f
find debian/python3-yaml-dbg -depth -empty -exec rmdir {} \;
dh_install
set -e && for i in $(build3vers); do \
echo "-- running tests for "$$i" plain --" ; \
python$$i -c "import sys ; sys.path.insert(0, 'debian/python3-yaml/usr/lib/python3/dist-packages/'); \
sys.path.insert(0, 'tests/lib3'); import test_all; test_all.main([])";\
done
set -e && for i in $(build3vers); do \
echo "-- running tests for "$$i" debug --" ; \
python$$i -c "import sys ; sys.path.insert(0, 'debian/python3-yaml-dbg/usr/lib/python3/dist-packages/'); \
sys.path.insert(0, 'tests/lib3'); import test_all; test_all.main([])";\
done
endif
# Put upstream _yaml.c back where we found it
mv $(CURDIR)/upstream.yaml.c $(CURDIR)/ext/_yaml.c
override_dh_installdocs:
cp $(CURDIR)/CHANGES $(CURDIR)/changelog
dh_installdocs
rm $(CURDIR)/changelog
override_dh_installdeb:
rm -rf debian/python-yaml-dbg/usr/share/doc/python-yaml-dbg
rm -rf $(CURDIR)/debian/python-yaml-dbg/usr/share/doc/python-yaml-dbg
ln -s python-yaml debian/python-yaml-dbg/usr/share/doc/python-yaml-dbg
rm -rf debian/python3-yaml-dbg/usr/share/doc/python3-yaml-dbg
rm -rf $(CURDIR)/debian/python3-yaml-dbg/usr/share/doc/python3-yaml-dbg
ln -s python3-yaml debian/python3-yaml-dbg/usr/share/doc/python3-yaml-dbg
dh_installdeb
override_dh_clean:
dh_clean
rm -rf build
rm -rf $(CURDIR)/build
This diff is collapsed.
......@@ -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
......
......@@ -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()
......
......@@ -7,11 +7,6 @@ from nodes import *
import datetime
try:
set
except NameError:
from sets import Set as set
import binascii, re, sys, types
class ConstructorError(MarkedYAMLError):
......@@ -58,11 +53,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)
......@@ -502,11 +497,7 @@ class Constructor(SafeConstructor):
raise ConstructorError("while constructing a Python object", mark,
"expected non-empty name appended to the tag", mark)
if u'.' in name:
# Python 2.4 only
#module_name, object_name = name.rsplit('.', 1)
items = name.split('.')
object_name = items.pop()
module_name = '.'.join(items)
module_name, object_name = name.rsplit('.', 1)
else:
module_name = '__builtin__'
object_name = name
......
......@@ -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():
......
......@@ -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:
......
......@@ -21,41 +21,6 @@ from error import YAMLError, Mark
import codecs, re
# Unfortunately, codec functions in Python 2.3 does not support the `finish`
# arguments, so we have to write our own wrappers.
try:
codecs.utf_8_decode('', 'strict', False)
from codecs import utf_8_decode, utf_16_le_decode, utf_16_be_decode
except TypeError:
def utf_16_le_decode(data, errors, finish=False):
if not finish and len(data) % 2 == 1:
data = data[:-1]
return codecs.utf_16_le_decode(data, errors)
def utf_16_be_decode(data, errors, finish=False):
if not finish and len(data) % 2 == 1:
data = data[:-1]
return codecs.utf_16_be_decode(data, errors)
def utf_8_decode(data, errors, finish=False):
if not finish:
# We are trying to remove a possible incomplete multibyte character
# from the suffix of the data.
# The first byte of a multi-byte sequence is in the range 0xc0 to 0xfd.
# All further bytes are in the range 0x80 to 0xbf.
# UTF-8 encoded UCS characters may be up to six bytes long.
count = 0
while count < 5 and count < len(data) \
and '\x80' <= data[-count-1] <= '\xBF':
count -= 1
if count < 5 and count < len(data) \
and '\xC0' <= data[-count-1] <= '\xFD':
data = data[:-count-1]
return codecs.utf_8_decode(data, errors)
class ReaderError(YAMLError):
def __init__(self, name, position, character, encoding, reason):
......@@ -159,13 +124,13 @@ class Reader(object):
self.update_raw()
if not isinstance(self.raw_buffer, unicode):
if self.raw_buffer.startswith(codecs.BOM_UTF16_LE):
self.raw_decode = utf_16_le_decode
self.raw_decode = codecs.utf_16_le_decode
self.encoding = 'utf-16-le'
elif self.raw_buffer.startswith(codecs.BOM_UTF16_BE):
self.raw_decode = utf_16_be_decode
self.raw_decode = codecs.utf_16_be_decode
self.encoding = 'utf-16-be'
else:
self.raw_decode = utf_8_decode
self.raw_decode = codecs.utf_8_decode
self.encoding = 'utf-8'
self.update(1)
......
......@@ -7,11 +7,6 @@ from nodes import *
import datetime
try:
set
except NameError:
from sets import Set as set
import sys, copy_reg, types
class RepresenterError(YAMLError):
......
......@@ -297,6 +297,10 @@ class Scanner(object):
# Check if a simple key is required at the current position.
required = not self.flow_level and self.indent == self.column
# A simple key is required only if it is the first token in the current
# line. Therefore it is always allowed.
assert self.allow_simple_key or not required
# The next token might be a simple key. Let's save it's number and
# position.
if self.allow_simple_key:
......
......@@ -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.
"""