summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2006-11-30 20:19:46 +0000
committerBob Ippolito <bob@redivi.com>2006-11-30 20:19:46 +0000
commitc2e4ffceae34dd1eb2804f17985b63712fe5c49f (patch)
tree0eb523793a6f1da334ee2d087d5691acd961c87f
parent905f2758e1710b677ba6721b9c0b9782e7a03617 (diff)
downloadsimplejson-c2e4ffceae34dd1eb2804f17985b63712fe5c49f.tar.gz
produce inf at runtime
git-svn-id: http://simplejson.googlecode.com/svn/trunk@34 a4795897-2c25-0410-b006-0d3caba88fa1
-rw-r--r--simplejson/encoder.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/simplejson/encoder.py b/simplejson/encoder.py
index 1f758e9..358521e 100644
--- a/simplejson/encoder.py
+++ b/simplejson/encoder.py
@@ -19,18 +19,15 @@ ESCAPE_DCT = {
for i in range(0x20):
ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,))
+# assume this produces an infinity on all machines (probably not guaranteed)
+INFINITY = float('1e66666')
+
def floatstr(o, allow_nan=True):
# Check for specials. Note that this type of test is processor- and/or
# platform-specific, so do tests which don't depend on the internals.
- # assume this produces an infinity on all machines (probably not guaranteed)
- INFINITY = 1e66666
-
if o != o:
text = 'NaN'
- elif o == 1.0:
- assert o != INFINITY
- return '1.0'
elif o == INFINITY:
text = 'Infinity'
elif o == -INFINITY: