The mod_ujson_load function doesn't handle nan though it is a valid representation:
>>> import ujson
>>> ujson.dumps(float('nan'))
'nan'
>>> ujson.loads(ujson.dumps(float('nan')))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: syntax error in JSON
Quick hack to solve this (sorry couldn't immediately figure out how to get the nan constant), line 115 in modujson.c:
} else if (S_CUR(s) == 'a' && S_NEXT(s) == 'n') {
S_NEXT(s);
next = mp_parse_num_decimal("nan", 3, false, false, NULL);
The mod_ujson_load function doesn't handle
nanthough it is a valid representation:Quick hack to solve this (sorry couldn't immediately figure out how to get the nan constant), line 115 in modujson.c: