Commits

Armin Rigo committed 45f85f6

Backout 1f8c162174c6. It fails some tests, in test_stringobject
(obvious place).

Comments (0)

Files changed (1)

pypy/objspace/std/stringobject.py

 
     for i in range(len(s)):
         c = s[i]
-        if not '\x20' <= c < '\x7f':
-            use_bs_char = False # character quoted by backspace
+        use_bs_char = False # character quoted by backspace
 
-            if c == '\\' or c == quote:
-                bs_char = c
-                use_bs_char = True
-            elif c == '\t':
-                bs_char = 't'
-                use_bs_char = True
-            elif c == '\r':
-                bs_char = 'r'
-                use_bs_char = True
-            elif c == '\n':
-                bs_char = 'n'
-                use_bs_char = True
-            else:
-                n = ord(c)
-                if i != startslice:
-                    buf.append_slice(s, startslice, i)
-                startslice = i + 1
-                buf.append('\\x')
-                buf.append("0123456789abcdef"[n>>4])
-                buf.append("0123456789abcdef"[n&0xF])
+        if c == '\\' or c == quote:
+            bs_char = c
+            use_bs_char = True
+        elif c == '\t':
+            bs_char = 't'
+            use_bs_char = True
+        elif c == '\r':
+            bs_char = 'r'
+            use_bs_char = True
+        elif c == '\n':
+            bs_char = 'n'
+            use_bs_char = True
+        elif not '\x20' <= c < '\x7f':
+            n = ord(c)
+            if i != startslice:
+                buf.append_slice(s, startslice, i)
+            startslice = i + 1
+            buf.append('\\x')
+            buf.append("0123456789abcdef"[n>>4])
+            buf.append("0123456789abcdef"[n&0xF])
 
-            if use_bs_char:
-                if i != startslice:
-                    buf.append_slice(s, startslice, i)
-                startslice = i + 1
-                buf.append('\\')
-                buf.append(bs_char)
+        if use_bs_char:
+            if i != startslice:
+                buf.append_slice(s, startslice, i)
+            startslice = i + 1
+            buf.append('\\')
+            buf.append(bs_char)
 
     if len(s) != startslice:
         buf.append_slice(s, startslice, len(s))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.