Skip to content

Commit 139501d

Browse files
committed
+1
1 parent de7b6aa commit 139501d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Lib/test/test_struct.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -935,12 +935,13 @@ def test_half_float(self):
935935
self.assertTrue(math.isnan(struct.unpack('<e', bits)[0]))
936936
self.assertTrue(math.isnan(struct.unpack('>e', bits[::-1])[0]))
937937

938-
if sys.platform != 'win32':
939-
# Check round-trip for NaN's:
940-
nan = struct.unpack('<e', bits)[0]
941-
self.assertEqual(struct.pack('<e', nan), bits)
942-
nan = struct.unpack('>e', bits[::-1])[0]
943-
self.assertEqual(struct.pack('>e', nan), bits[::-1])
938+
# Check round-trip for NaN's:
939+
if sys.platform == 'win32' and int.from_bytes(bits[::-1]) & (1<<9):
940+
continue # doesn't work for sNaN's here
941+
nan = struct.unpack('<e', bits)[0]
942+
self.assertEqual(struct.pack('<e', nan), bits)
943+
nan = struct.unpack('>e', bits[::-1])[0]
944+
self.assertEqual(struct.pack('>e', nan), bits[::-1])
944945

945946
# Check that packing produces a bit pattern representing a quiet NaN:
946947
# all exponent bits and the msb of the fraction should all be 1.

0 commit comments

Comments
 (0)