##// END OF EJS Templates
py3: replace str with bytes in isinstance()
Pulkit Goyal -
r32128:c3342c17 default
parent child Browse files
Show More
@@ -231,7 +231,7 b' def json(obj, paranoid=True):'
231 return 'true'
231 return 'true'
232 elif isinstance(obj, (int, long, float)):
232 elif isinstance(obj, (int, long, float)):
233 return pycompat.bytestr(obj)
233 return pycompat.bytestr(obj)
234 elif isinstance(obj, str):
234 elif isinstance(obj, bytes):
235 return '"%s"' % encoding.jsonescape(obj, paranoid=paranoid)
235 return '"%s"' % encoding.jsonescape(obj, paranoid=paranoid)
236 elif util.safehasattr(obj, 'keys'):
236 elif util.safehasattr(obj, 'keys'):
237 out = ['%s: %s' % (json(k), json(v))
237 out = ['%s: %s' % (json(k), json(v))
@@ -355,7 +355,7 b' def stringify(thing):'
355 text and concatenating them.
355 text and concatenating them.
356 """
356 """
357 thing = templatekw.unwraphybrid(thing)
357 thing = templatekw.unwraphybrid(thing)
358 if util.safehasattr(thing, '__iter__') and not isinstance(thing, str):
358 if util.safehasattr(thing, '__iter__') and not isinstance(thing, bytes):
359 return "".join([stringify(t) for t in thing if t is not None])
359 return "".join([stringify(t) for t in thing if t is not None])
360 if thing is None:
360 if thing is None:
361 return ""
361 return ""
General Comments 0
You need to be logged in to leave comments. Login now