Skip to content

Commit e6c1c12

Browse files
committed
+1
1 parent de7b6aa commit e6c1c12

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Lib/test/test_struct.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -935,12 +935,14 @@ 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'
940+
and not (int.from_bytes(bits[::-1]) & (1<<9))):
941+
continue # doesn't work for sNaN's here
942+
nan = struct.unpack('<e', bits)[0]
943+
self.assertEqual(struct.pack('<e', nan), bits)
944+
nan = struct.unpack('>e', bits[::-1])[0]
945+
self.assertEqual(struct.pack('>e', nan), bits[::-1])
944946

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

0 commit comments

Comments
 (0)