summaryrefslogtreecommitdiff
path: root/simplejson/encoder.py
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2009-02-16 04:51:11 +0000
committerBob Ippolito <bob@redivi.com>2009-02-16 04:51:11 +0000
commitcf3c2982660b9b654c9cb8347bdbab67c2e1ca7a (patch)
treeb838ac4294dd361f6af838b935effde5b3c1191d /simplejson/encoder.py
parentf909e2fb180a63dccb8311b28ec8ea5db34c9466 (diff)
downloadsimplejson-cf3c2982660b9b654c9cb8347bdbab67c2e1ca7a.tar.gz
replace a few string formats with string addition to make py26+ porting easier
git-svn-id: http://simplejson.googlecode.com/svn/trunk@168 a4795897-2c25-0410-b006-0d3caba88fa1
Diffstat (limited to 'simplejson/encoder.py')
-rw-r--r--simplejson/encoder.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/simplejson/encoder.py b/simplejson/encoder.py
index 056847b..d13b03d 100644
--- a/simplejson/encoder.py
+++ b/simplejson/encoder.py
@@ -171,7 +171,7 @@ class JSONEncoder(object):
return JSONEncoder.default(self, o)
"""
- raise TypeError("%r is not JSON serializable" % (o,))
+ raise TypeError(repr(o) + " is not JSON serializable")
def encode(self, o):
"""Return a JSON string representation of a Python data structure.
@@ -237,8 +237,9 @@ class JSONEncoder(object):
return _repr(o)
if not allow_nan:
- raise ValueError("Out of range float values are not JSON compliant: %r"
- % (o,))
+ raise ValueError(
+ "Out of range float values are not JSON compliant: " +
+ repr(o))
return text
@@ -367,7 +368,7 @@ def _make_iterencode(markers, _default, _encoder, _indent, _floatstr, _key_separ
elif _skipkeys:
continue
else:
- raise TypeError("key %r is not a string" % (key,))
+ raise TypeError("key " + repr(key) + " is not a string")
if first:
first = False
else: