fix for py2 .. takes different args/kwargs

This commit is contained in:
Tobias Oberstein 2017-04-05 10:33:37 +02:00
parent 60c021673b
commit 0c742243fc
1 changed files with 6 additions and 2 deletions

View File

@ -150,12 +150,16 @@ class _WAMPJsonEncoder(json.JSONEncoder):
return json.JSONEncoder.default(self, obj)
#
# the following is a hack. see http://bugs.python.org/issue29992
#
from json import scanner
from json.decoder import scanstring
def _parse_string(string, idx, strict):
s, idx = scanstring(string, idx, strict)
def _parse_string(*args, **kwargs):
s, idx = scanstring(*args, **kwargs)
if s and s[0] == u'\x00':
s = base64.b64decode(s[1:])
return s, idx