core: fix JSONDecodeError import for last python2.7 versions...

This commit is contained in:
p1-bmu 2020-11-30 11:10:06 +01:00
parent b683dbb15b
commit 63a36554e8
1 changed files with 6 additions and 1 deletions

View File

@ -33,13 +33,18 @@ __all__ = ['EltErr', 'REPR_RAW', 'REPR_HEX', 'REPR_BIN', 'REPR_HD', 'REPR_HUM',
try:
from json import JSONEncoder, JSONDecoder, JSONDecodeError
from json import JSONEncoder, JSONDecoder
except ImportError:
_with_json = False
else:
_with_json = True
JsonEnc = JSONEncoder(sort_keys=True, indent=1)
JsonDec = JSONDecoder()
try:
import JSONDecodeError
except ImportError:
# it seems Python2.7 removed support for JSONDecodeError at some point
JSONDecodeError = ValueError
from .utils import *
from .charpy import Charpy, CharpyErr