Commit 372ed2d0 authored by Kirill Smelkov's avatar Kirill Smelkov

py2: amari.xlog: Accept both str and unicode for "expected to be string" entries

json might decode them as unicode.
parent b00073fe
......@@ -676,6 +676,10 @@ def get1(xd, key, typeok):
if key not in xd:
raise ParseError("%s:%d/%s no `%s`" %
(xd.pos[0], xd.pos[1], '/'.join(xd.path), key))
# py2
if typeok == str:
typeok = (str, unicode)
val = xd[key]
if not isinstance(val, typeok):
raise ParseError("%s:%d/%s : got %s ; expected `%s`" %
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment