From 657a10c09d47d9e7ddd14af3339f3b2855780fd7 Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Tue, 12 Jun 2018 13:24:53 +0100 Subject: [PATCH] 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. --- wa/utils/serializer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wa/utils/serializer.py b/wa/utils/serializer.py index 1b7c1a74..b9147004 100644 --- a/wa/utils/serializer.py +++ b/wa/utils/serializer.py @@ -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))