1.1 --- a/lib/__builtins__/str.py Sat Feb 04 00:10:47 2017 +0100
1.2 +++ b/lib/__builtins__/str.py Sat Feb 04 00:12:06 2017 +0100
1.3 @@ -127,13 +127,7 @@
1.4 elif c == "\r":
1.5 b.append("\\r")
1.6 else:
1.7 - if n < 0:
1.8 - n += 256
1.9 - b.append("\\x")
1.10 - x = hex(n, "")
1.11 - if len(x) < 2:
1.12 - b.append("0")
1.13 - b.append(x)
1.14 + self._quote_value(b, n)
1.15
1.16 i += 1
1.17 last = i
1.18 @@ -144,6 +138,18 @@
1.19 b.append(quote)
1.20 return str(b)
1.21
1.22 + def _quote_value(self, b, n):
1.23 +
1.24 + "Append to 'b' the quoted form of 'n'."
1.25 +
1.26 + if n < 0:
1.27 + n += 256
1.28 + b.append("\\x")
1.29 + x = hex(n, "")
1.30 + if len(x) < 2:
1.31 + b.append("0")
1.32 + b.append(x)
1.33 +
1.34 def bytelength(self):
1.35
1.36 "Return the number of bytes in this string."