Skip to content

Commit

Permalink
Fix logic for quoting special characters (#276)
Browse files Browse the repository at this point in the history
* Fix logic for quoting special characters

* Remove has_ucs4 from condition

on systems with `sys.maxunicode <= 0xffff` the comparison
(u'\U00010000' <= ch < u'\U0010ffff') can't be true anyway I think
  • Loading branch information
perlpunk committed Mar 31, 2019
1 parent 66454d9 commit 60ca52d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/yaml/emitter.py
Expand Up @@ -706,7 +706,7 @@ def analyze_scalar(self, scalar):
if not (ch == u'\n' or u'\x20' <= ch <= u'\x7E'):
if (ch == u'\x85' or u'\xA0' <= ch <= u'\uD7FF'
or u'\uE000' <= ch <= u'\uFFFD'
or ((not has_ucs4) or (u'\U00010000' <= ch < u'\U0010ffff'))) and ch != u'\uFEFF':
or (u'\U00010000' <= ch < u'\U0010ffff')) and ch != u'\uFEFF':
unicode_characters = True
if not self.allow_unicode:
special_characters = True
Expand Down

0 comments on commit 60ca52d

Please sign in to comment.