1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-03-21 01:59:13 +00:00

utils/serializer: fix level deserialization

Fix a regression introduced with Python 3 port -- JSON deserializer
should check for basestring rather than str when deciding whether to try
to decode a custom type.
This commit is contained in:
Sergei Trofimov 2018-06-12 13:24:53 +01:00 committed by setrofim
parent b6531feb52
commit 657a10c09d

View File

@ -50,6 +50,8 @@ from datetime import datetime
import yaml as _yaml
import dateutil.parser
from past.builtins import basestring
from wa.framework.exception import SerializerSyntaxError
from wa.utils.misc import isiterable
from wa.utils.types import regex_type, none_type, level, cpu_mask
@ -104,7 +106,7 @@ class WAJSONDecoder(_json.JSONDecoder):
d = _json.JSONDecoder.decode(self, s, **kwargs)
def try_parse_object(v):
if isinstance(v, str):
if isinstance(v, basestring):
if v.startswith('REGEX:'):
_, flags, pattern = v.split(':', 2)
return re.compile(pattern, int(flags or 0))