# HG changeset patch # User Bob Ippolito <bob@redivi.com> # Date 1164917986 0 # Thu Nov 30 20:19:46 2006 +0000 # Node ID c480a37b14c8a2582b0afd866e7433f303f2ab9a # Parent f625396d13bc5b65505300b6016d3c7886cd7ee9 produce inf at runtime git-svn-id: http://simplejson.googlecode.com/svn/trunk@34 a4795897-2c25-0410-b006-0d3caba88fa1 diff --git a/simplejson/encoder.py b/simplejson/encoder.py --- a/simplejson/encoder.py +++ b/simplejson/encoder.py @@ -19,18 +19,15 @@ 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: