Skip to content

Commit 5e96373

Browse files
committed
Provide a fallback in case simplejson can't be loaded
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40477
1 parent a761a7a commit 5e96373

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

tests/test_tokenizer.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,16 @@
55
import unittest
66
import new
77

8-
import simplejson
8+
try:
9+
import simplejson
10+
except:
11+
import re
12+
class simplejson:
13+
def load(f):
14+
true, false = True, False
15+
input=re.sub(r'(".*?(?<!\\)")',r'u\1',f.read().decode('utf-8'))
16+
return eval(input)
17+
load = staticmethod(load)
918

1019
#Allow us to import the parent module
1120
os.chdir(os.path.split(os.path.abspath(__file__))[0])

0 commit comments

Comments
 (0)