# HG changeset patch # User Augie Fackler # Date 2015-04-14 20:18:11 # Node ID 9c28f3236677d8321fedd7258b72713ab44ee223 # Parent 28526bb5b3b512d919454de37fcbe67e83ab1056 run-tests: do cdata escaping using bytes instead of str diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -354,7 +354,7 @@ def vlog(*msg): # Bytes that break XML even in a CDATA block: control characters 0-31 # sans \t, \n and \r -CDATA_EVIL = re.compile(r"[\000-\010\013\014\016-\037]") +CDATA_EVIL = re.compile(br"[\000-\010\013\014\016-\037]") def cdatasafe(data): """Make a string safe to include in a CDATA block. @@ -364,7 +364,7 @@ def cdatasafe(data): replaces illegal bytes with ? and adds a space between the ]] so that it won't break the CDATA block. """ - return CDATA_EVIL.sub('?', data).replace(']]>', '] ]>') + return CDATA_EVIL.sub(b'?', data).replace(b']]>', b'] ]>') def log(*msg): """Log something to stdout.