diff --git a/simplejson/encoder.py b/simplejson/encoder.py index f625396d13bc5b65505300b6016d3c7886cd7ee9_c2ltcGxlanNvbi9lbmNvZGVyLnB5..c480a37b14c8a2582b0afd866e7433f303f2ab9a_c2ltcGxlanNvbi9lbmNvZGVyLnB5 100644 --- a/simplejson/encoder.py +++ b/simplejson/encoder.py @@ -19,7 +19,10 @@ 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. @@ -22,9 +25,6 @@ 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' @@ -29,8 +29,5 @@ if o != o: text = 'NaN' - elif o == 1.0: - assert o != INFINITY - return '1.0' elif o == INFINITY: text = 'Infinity' elif o == -INFINITY: