diff options
author | xi <xi@18f92427-320e-0410-9341-c67f048884a3> | 2011-05-30 04:19:04 +0000 |
---|---|---|
committer | xi <xi@18f92427-320e-0410-9341-c67f048884a3> | 2011-05-30 04:19:04 +0000 |
commit | d6173834c1eebe1d8529164c49c6e515f5543d87 (patch) | |
tree | 45bc787a916685630d5adad43fec14bfddb12b20 | |
parent | 205d9c2ce38f59dd28830c9884db61e5675b2886 (diff) | |
download | pyyaml-d6173834c1eebe1d8529164c49c6e515f5543d87.tar.gz |
Dropped support for Python 2.3 and 2.4.
git-svn-id: http://svn.pyyaml.org/pyyaml/trunk@380 18f92427-320e-0410-9341-c67f048884a3
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | announcement.msg | 2 | ||||
-rw-r--r-- | lib/yaml/constructor.py | 11 | ||||
-rw-r--r-- | lib/yaml/reader.py | 41 | ||||
-rw-r--r-- | lib/yaml/representer.py | 5 |
5 files changed, 7 insertions, 53 deletions
@@ -8,6 +8,7 @@ For a complete Subversion changelog, see 'http://pyyaml.org/log/pyyaml'. (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) ----------------- diff --git a/announcement.msg b/announcement.msg index 8cb814c..e94b580 100644 --- a/announcement.msg +++ b/announcement.msg @@ -19,6 +19,8 @@ Changes * 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. +* Dropped support for Python 2.3 and 2.4; currently supported versions + are 2.5 to 3.2. Resources diff --git a/lib/yaml/constructor.py b/lib/yaml/constructor.py index 081d78a..635faac 100644 --- a/lib/yaml/constructor.py +++ b/lib/yaml/constructor.py @@ -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): @@ -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 diff --git a/lib/yaml/reader.py b/lib/yaml/reader.py index 1e7a4db..3249e6b 100644 --- a/lib/yaml/reader.py +++ b/lib/yaml/reader.py @@ -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) diff --git a/lib/yaml/representer.py b/lib/yaml/representer.py index f5606ec..5f4fc70 100644 --- a/lib/yaml/representer.py +++ b/lib/yaml/representer.py @@ -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): |