summaryrefslogtreecommitdiff
path: root/simplejson
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-03-29 07:10:00 +0100
committerRichard van der Hoff <richard@matrix.org>2018-03-29 07:10:00 +0100
commit05b8f6dfdfcf49cc1f7ebf8bbb38b7be274ad40f (patch)
tree36301eb2287683900c106f517ff8b4973585b8e6 /simplejson
parent19012377f349da419f80e91ecd41d5f09f90d32b (diff)
downloadsimplejson-05b8f6dfdfcf49cc1f7ebf8bbb38b7be274ad40f.tar.gz
Simplify ESCAPE regexp construction
Now that we do not include \uNNNN escapes in the regex, we can use a raw string rather than having to double-escape everything.
Diffstat (limited to 'simplejson')
-rw-r--r--simplejson/encoder.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/simplejson/encoder.py b/simplejson/encoder.py
index b2b8775..faf87a8 100644
--- a/simplejson/encoder.py
+++ b/simplejson/encoder.py
@@ -17,10 +17,7 @@ c_encode_basestring_ascii, c_make_encoder = _import_speedups()
from .decoder import PosInf
from .raw_json import RawJSON
-#ESCAPE = re.compile(ur'[\x00-\x1f\\"\b\f\n\r\t]')
-# This is required because u() will mangle the string and ur'' isn't valid
-# python3 syntax
-ESCAPE = re.compile(u'[\\x00-\\x1f\\\\"\\b\\f\\n\\r\\t]')
+ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]')
ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])')
HAS_UTF8 = re.compile(r'[\x80-\xff]')
ESCAPE_DCT = {