summaryrefslogtreecommitdiff
path: root/reader.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2018-07-01 16:25:00 +0200
committerAnthon van der Neut <anthon@mnt.org>2018-07-01 16:25:00 +0200
commitc3869f9866e3507bbb6767aeb5bc02ba41a98d60 (patch)
treed901c684ffdb978a02dd83a728e609e6a07c8b97 /reader.py
parent4eed1d5eef4f20ea32ee7af1f01d02ffcc7e229c (diff)
downloadruamel.yaml-c3869f9866e3507bbb6767aeb5bc02ba41a98d60.tar.gz
fix regression caused by PR 270.15.42
Diffstat (limited to 'reader.py')
-rw-r--r--reader.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/reader.py b/reader.py
index 9686aa8..96bb96b 100644
--- a/reader.py
+++ b/reader.py
@@ -21,10 +21,9 @@ from __future__ import absolute_import
# character.
import codecs
-import re
from ruamel.yaml.error import YAMLError, FileMark, StringMark, YAMLStreamError
-from ruamel.yaml.compat import text_type, binary_type, PY3
+from ruamel.yaml.compat import text_type, binary_type, PY3, UNICODE_SIZE
from ruamel.yaml.util import RegExp
if False: # MYPY
@@ -180,17 +179,13 @@ class Reader(object):
self.encoding = 'utf-8'
self.update(1)
- # 4 if 32 bit unicode supported, 2 e.g. on MacOS (issue 56)
- try:
- re.compile(u'[^\U00010000]')
- except: # NOQA
+ if UNICODE_SIZE == 2:
NON_PRINTABLE = RegExp(
u'[^\x09\x0A\x0D\x20-\x7E\x85'
u'\xA0-\uD7FF'
u'\uE000-\uFFFD'
u']'
)
- UNICODE_SIZE = 2
else:
NON_PRINTABLE = RegExp(
u'[^\x09\x0A\x0D\x20-\x7E\x85'
@@ -199,7 +194,6 @@ class Reader(object):
u'\U00010000-\U0010FFFF'
u']'
)
- UNICODE_SIZE = 4
_printable_ascii = ('\x09\x0A\x0D' + ''.join(map(chr, range(0x20, 0x7F)))).encode('ascii')