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

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


http://hg.python.org/cpython/rev/c13066f752a8
changeset:   77099:c13066f752a8
branch:      2.7
parent:      77087:4973c90ce9e6
user:        Ezio Melotti <ezio.melotti at gmail.com>
date:        Mon May 21 17:46:55 2012 -0600
summary:
  #14875: Use float('inf') instead of float('1e66666') in the json module.

files:
  Lib/json/encoder.py |  3 +--
  Misc/NEWS           |  4 +++-
  2 files changed, 4 insertions(+), 3 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
@@ -64,6 +64,8 @@
 Library
 -------
 
+- Issue #14875: Use float('inf') instead of float('1e66666') in the json module.
+
 - Issue #14572: Prevent build failures with pre-3.5.0 versions of
   sqlite3, such as was shipped with Centos 5 and Mac OS X 10.4.
 
@@ -119,7 +121,7 @@
 
 - Issue #13684: Fix httplib tunnel issue of infinite loops for certain sites
   which send EOF without trailing \r\n.
- 
+
 - Issue #14308: Fix an exception when a "dummy" thread is in the threading
   module's active list after a fork().
 

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


More information about the Python-checkins mailing list