Mercurial > hg
changeset 32128:c3342c177211
py3: replace str with bytes in isinstance()
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Thu, 20 Apr 2017 19:57:16 +0530 |
parents | 964e7427a691 |
children | f0ea0f642627 |
files | mercurial/templatefilters.py |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/templatefilters.py Thu Apr 27 09:49:57 2017 +0530 +++ b/mercurial/templatefilters.py Thu Apr 20 19:57:16 2017 +0530 @@ -231,7 +231,7 @@ return 'true' elif isinstance(obj, (int, long, float)): return pycompat.bytestr(obj) - elif isinstance(obj, str): + elif isinstance(obj, bytes): return '"%s"' % encoding.jsonescape(obj, paranoid=paranoid) elif util.safehasattr(obj, 'keys'): out = ['%s: %s' % (json(k), json(v)) @@ -355,7 +355,7 @@ text and concatenating them. """ thing = templatekw.unwraphybrid(thing) - if util.safehasattr(thing, '__iter__') and not isinstance(thing, str): + if util.safehasattr(thing, '__iter__') and not isinstance(thing, bytes): return "".join([stringify(t) for t in thing if t is not None]) if thing is None: return ""