[pypy-commit] pypy json-decoder-maps-py3.6: test and fix
cfbolz
pypy.commits at gmail.com
Tue Jun 11 07:32:15 EDT 2019
Author: Carl Friedrich Bolz-Tereick <cfbolz at gmx.de>
Branch: json-decoder-maps-py3.6
Changeset: r96793:36f4881e7ef5
Date: 2019-06-11 13:31 +0200
http://bitbucket.org/pypy/pypy/changeset/36f4881e7ef5/
Log: test and fix
diff --git a/pypy/module/_pypyjson/interp_decoder.py b/pypy/module/_pypyjson/interp_decoder.py
--- a/pypy/module/_pypyjson/interp_decoder.py
+++ b/pypy/module/_pypyjson/interp_decoder.py
@@ -280,8 +280,8 @@
def _raise_object_error(self, ch, start, i):
if ch == '\0':
self._raise("Unterminated object starting at", start)
- else:
- self._raise("Unexpected '%s' when decoding object (char %d)" % ch, i)
+ else:?!?jedi=0, ?!? (*_*param msg*_*, param pos) ?!?jedi?!?
+ self._raise("Unexpected '%s' when decoding object" % ch, i)
def decode_array(self, i):
""" Decode a list. i must be after the opening '[' """
diff --git a/pypy/module/_pypyjson/test/test__pypyjson.py b/pypy/module/_pypyjson/test/test__pypyjson.py
--- a/pypy/module/_pypyjson/test/test__pypyjson.py
+++ b/pypy/module/_pypyjson/test/test__pypyjson.py
@@ -488,6 +488,7 @@
('["]', 'Unterminated string starting at', 1),
('["spam":', "Unexpected ':' when decoding array", 7),
('[{]', "Key name must be string at char", 2),
+ ('{"a": 1 "b": 2}', "Unexpected '\"' when decoding object", 8),
]
for inputtext, errmsg, errpos in test_cases:
exc = raises(ValueError, _pypyjson.loads, inputtext)
More information about the pypy-commit
mailing list