summaryrefslogtreecommitdiff
path: root/simplejson/encoder.py
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2012-12-29 12:41:55 -0800
committerBob Ippolito <bob@redivi.com>2012-12-29 12:41:55 -0800
commit16ae2381fc14d4e91fa3af5d82e01eda6929572e (patch)
tree4e5c2554bc5083a1a107e706050e99121e35a759 /simplejson/encoder.py
parent83a493db6a8b859ec7b10fa85365dd3fdf144c68 (diff)
downloadsimplejson-16ae2381fc14d4e91fa3af5d82e01eda6929572e.tar.gz
more coverage, decimal key coercion
Diffstat (limited to 'simplejson/encoder.py')
-rw-r--r--simplejson/encoder.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/simplejson/encoder.py b/simplejson/encoder.py
index dad59fc..385c19a 100644
--- a/simplejson/encoder.py
+++ b/simplejson/encoder.py
@@ -440,7 +440,7 @@ def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,
del markers[markerid]
def _stringify_key(key):
- if isinstance(key, string_types):
+ if isinstance(key, string_types): # pragma: no cover
pass
elif isinstance(key, binary_type):
key = key.decode(_encoding)
@@ -454,6 +454,8 @@ def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,
key = 'null'
elif isinstance(key, integer_types):
key = str(key)
+ elif _use_decimal and isinstance(key, Decimal):
+ key = str(key)
elif _skipkeys:
key = None
else: