[Python-checkins] cpython (3.2): #14875: Use float('inf') instead of float('1e66666') in the json module.

ezio.melotti python-checkins at python.org
Tue May 22 01:54:06 CEST 2012


http://hg.python.org/cpython/rev/06f21c6e0f2b
changeset:   77100:06f21c6e0f2b
branch:      3.2
parent:      77092:d13fdd97cc8e
user:        Ezio Melotti <ezio.melotti at gmail.com>
date:        Mon May 21 17:49:06 2012 -0600
summary:
  #14875: Use float('inf') instead of float('1e66666') in the json module.

files:
  Lib/json/encoder.py |  3 +--
  Misc/NEWS           |  2 ++
  2 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/Lib/json/encoder.py b/Lib/json/encoder.py
--- a/Lib/json/encoder.py
+++ b/Lib/json/encoder.py
@@ -27,8 +27,7 @@
     ESCAPE_DCT.setdefault(chr(i), '\\u{0:04x}'.format(i))
     #ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,))
 
-# Assume this produces an infinity on all machines (probably not guaranteed)
-INFINITY = float('1e66666')
+INFINITY = float('inf')
 FLOAT_REPR = repr
 
 def encode_basestring(s):
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -67,6 +67,8 @@
 Library
 -------
 
+- Issue #14875: Use float('inf') instead of float('1e66666') in the json module.
+
 - Issue #14426: Correct the Date format in Expires attribute of Set-Cookie
   Header in Cookie.py.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list