Show More
@@ -249,13 +249,9 b' def json(obj, paranoid=True):' | |||||
249 | return pycompat.bytestr(obj) |
|
249 | return pycompat.bytestr(obj) | |
250 | elif isinstance(obj, bytes): |
|
250 | elif isinstance(obj, bytes): | |
251 | return '"%s"' % encoding.jsonescape(obj, paranoid=paranoid) |
|
251 | return '"%s"' % encoding.jsonescape(obj, paranoid=paranoid) | |
252 |
elif isinstance(obj, |
|
252 | elif isinstance(obj, type(u'')): | |
253 | # This branch is unreachable on Python 2, because bytes == str |
|
|||
254 | # and we'll return in the next-earlier block in the elif |
|
|||
255 | # ladder. On Python 3, this helps us catch bugs before they |
|
|||
256 | # hurt someone. |
|
|||
257 | raise error.ProgrammingError( |
|
253 | raise error.ProgrammingError( | |
258 |
'Mercurial only does output with bytes |
|
254 | 'Mercurial only does output with bytes: %r' % obj) | |
259 | elif util.safehasattr(obj, 'keys'): |
|
255 | elif util.safehasattr(obj, 'keys'): | |
260 | out = ['"%s": %s' % (encoding.jsonescape(k, paranoid=paranoid), |
|
256 | out = ['"%s": %s' % (encoding.jsonescape(k, paranoid=paranoid), | |
261 | json(v, paranoid)) |
|
257 | json(v, paranoid)) |
General Comments 0
You need to be logged in to leave comments.
Login now