Author: Antonio Cuni <[email protected]>
Branch: fastjson
Changeset: r64771:d04ad613ac6b
Date: 2013-06-04 16:23 +0200
http://bitbucket.org/pypy/pypy/changeset/d04ad613ac6b/

Log:    what is not tested is broken: test&fix

diff --git a/pypy/module/_fastjson/interp_decoder.py 
b/pypy/module/_fastjson/interp_decoder.py
--- a/pypy/module/_fastjson/interp_decoder.py
+++ b/pypy/module/_fastjson/interp_decoder.py
@@ -81,10 +81,10 @@
                 self.last_type = TYPE_STRING
                 return self.space.wrap(content_unicode)
             elif ch == '\\':
-                newchar = self.decode_escape_sequence()
-                builder.append_multiple_char(newchar, 1) # we should implement 
append_char
+                ch = self.decode_escape_sequence()
+                builder.append_multiple_char(ch, 1) # we should implement 
append_char
             else:
-                builder.append_multiple_char(newchar, 1)
+                builder.append_multiple_char(ch, 1)
             
         raise operationerrfmt(self.space.w_ValueError,
                               "Unterminated string starting at char %d", start)
diff --git a/pypy/module/_fastjson/test/test__fastjson.py 
b/pypy/module/_fastjson/test/test__fastjson.py
--- a/pypy/module/_fastjson/test/test__fastjson.py
+++ b/pypy/module/_fastjson/test/test__fastjson.py
@@ -53,3 +53,8 @@
         assert _fastjson.loads(r'"\n"') == u'\n'
         assert _fastjson.loads(r'"\r"') == u'\r'
         assert _fastjson.loads(r'"\t"') == u'\t'
+
+    def test_escape_sequence_in_the_middle(self):
+        import _fastjson
+        s = r'"hello\nworld"'
+        assert _fastjson.loads(s) == "hello\nworld"
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to