summaryrefslogtreecommitdiff
path: root/Lib/json/decoder.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/json/decoder.py')
-rw-r--r--Lib/json/decoder.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/Lib/json/decoder.py b/Lib/json/decoder.py
index 1b4323839b..5141f879d9 100644
--- a/Lib/json/decoder.py
+++ b/Lib/json/decoder.py
@@ -15,10 +15,8 @@ __all__ = ['JSONDecoder']
FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL
def _floatconstants():
- _BYTES = '7FF80000000000007FF0000000000000'.decode('hex')
- if sys.byteorder != 'big':
- _BYTES = _BYTES[:8][::-1] + _BYTES[8:][::-1]
- nan, inf = struct.unpack('dd', _BYTES)
+ nan, = struct.unpack('>d', b'\x7f\xf8\x00\x00\x00\x00\x00\x00')
+ inf, = struct.unpack('>d', b'\x7f\xf0\x00\x00\x00\x00\x00\x00')
return nan, inf, -inf
NaN, PosInf, NegInf = _floatconstants()