changeset 22476:a0829ec34dbd

formatter: convert float value to json It will be used to encode ctx.date().
author Yuya Nishihara <yuya@tcha.org>
date Wed, 17 Sep 2014 22:21:01 +0900
parents 17eeda31e52b
children 3c8ae79eacb0
files mercurial/formatter.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/formatter.py	Wed Sep 17 21:30:22 2014 +0900
+++ b/mercurial/formatter.py	Wed Sep 17 22:21:01 2014 +0900
@@ -91,8 +91,8 @@
 def _jsonifyobj(v):
     if isinstance(v, tuple):
         return '[' + ', '.join(_jsonifyobj(e) for e in v) + ']'
-    elif isinstance(v, int):
-        return '%d' % v
+    elif isinstance(v, (int, float)):
+        return str(v)
     else:
         return '"%s"' % encoding.jsonescape(v)