modujson: .loads(): Handle more whitespace characters.

stackless
Paul Sokolovsky 2015-01-23 18:36:28 +02:00
parent 1f04336b23
commit 444331c07f
2 changed files with 6 additions and 0 deletions

View File

@ -81,6 +81,9 @@ STATIC mp_obj_t mod_ujson_loads(mp_obj_t obj) {
case ',':
case ':':
case ' ':
case '\t':
case '\n':
case '\r':
s += 1;
goto cont;
case 'n':

View File

@ -30,3 +30,6 @@ my_print(json.loads('{}'))
my_print(json.loads('{"a":true}'))
my_print(json.loads('{"a":null, "b":false, "c":true}'))
my_print(json.loads('{"a":[], "b":[1], "c":{"3":4}}'))
# whitespace handling
my_print(json.loads('{\n\t"a":[]\r\n, "b":[1], "c":{"3":4} \n\r\t\r\r\r\n}'))