summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordexbol <dexbolg@gmail.com>2015-03-23 22:11:17 +0800
committerdexbol <dexbolg@gmail.com>2015-03-23 22:11:17 +0800
commita297f91cf11786178759692c218b630f2fdcd085 (patch)
treed0f3180c1e886debb7a1daedd44a3708335bc5bc
parent03ed722916bf8d376927bef7febb392fc7e218a4 (diff)
downloadpyscss-a297f91cf11786178759692c218b630f2fdcd085.tar.gz
Workaround for narrow Python build
More info: http://stackoverflow.com/questions/7105874/valueerror-unichr-arg-not-in-range0x10000-narrow-python-build-please-hel
-rw-r--r--scss/cssdefs.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/scss/cssdefs.py b/scss/cssdefs.py
index 46b6877..a8d3dc5 100644
--- a/scss/cssdefs.py
+++ b/scss/cssdefs.py
@@ -448,7 +448,11 @@ escape_rx = re.compile(r"(?s)\\([0-9a-fA-F]{1,6})[\n\t ]?|\\(.)|\\\n")
def _unescape_one(match):
if match.group(1) is not None:
- return six.unichr(int(match.group(1), 16))
+ try:
+ return six.unichr(int(match.group(1), 16))
+ except ValueError:
+ return (r'\U%08x' % int(match.group(1), 16)).decode(
+ 'unicode-escape')
elif match.group(2) is not None:
return match.group(2)
else: