[pypy-commit] pypy fastjson: text and fix for the + sign
antocuni
noreply at buildbot.pypy.org
Tue Jun 25 19:01:48 CEST 2013
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: fastjson
Changeset: r64981:89c55c007418
Date: 2013-06-25 18:59 +0200
http://bitbucket.org/pypy/pypy/changeset/89c55c007418/
Log: text and fix for the + sign
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
@@ -152,6 +152,8 @@
if self.ll_chars[i] == '-':
sign = -1
i += 1
+ elif self.ll_chars[i] == '+':
+ i += 1
i, intval, _ = self.parse_digits(i)
return i, sign * intval
@@ -314,8 +316,8 @@
val = int(hexdigits, 16)
if val & 0xfc00 == 0xd800:
# surrogate pair
+ i += 6
val = self.decode_surrogate_pair(i, val)
- i += 6
except ValueError:
self._raise("Invalid \uXXXX escape (char %d)", i-1)
return # help the annotator to know that we'll never go beyond
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
@@ -111,6 +111,7 @@
check('42E0', 42.0)
check('42E3', 42000.0)
check('42E-1', 4.2)
+ check('42E+1', 420.0)
check('42.123E3', 42123.0)
def test_decode_numeric_invalid(self):
@@ -125,7 +126,6 @@
error('12E')
error('12E-')
-
def test_decode_object(self):
import _fastjson
assert _fastjson.loads('{}') == {}
@@ -154,3 +154,4 @@
expected = u'z\U0001d120x'
res = _fastjson.loads('"z\\ud834\\udd20x"')
assert res == expected
+
More information about the pypy-commit
mailing list