@@ -244,26 +244,14 @@ def test_numbers(self):
244244 msg = "{0!r} != {1!r}; testcase={2!r}" .format (a , b , testcase ))
245245
246246 def test_float16_endianness (self ):
247- # gh-154568: the slow-path decoder for IEEE_754_FLOAT16_LE/BE
248- # compared mformat_code against the 32-bit float constant
249- # (IEEE_754_FLOAT_LE) instead of the float16 one, so it always
250- # decoded as big-endian regardless of what was requested.
251- #
252- # A real 'e'-typecode array only exercises the slow (converting)
253- # path when the requested mformat disagrees with the *native*
254- # float16 format, so which of LE/BE actually exercises the buggy
255- # branch depends on the test machine's endianness, and the other
256- # direction happens to come out "correct by coincidence" because
257- # the bug unconditionally decodes as big-endian. Using a
258- # typecode ('d') whose native mformat can never match
259- # IEEE_754_FLOAT16_LE/BE forces the slow path deterministically
260- # on any machine, so both directions are actually exercised.
261- le_bytes = struct .pack ('<e' , 1.0 )
262- be_bytes = struct .pack ('>e' , 1.0 )
247+ # gh-154568: array_reconstructor() slow-path decoder for
248+ # IEEE_754_FLOAT16_LE ignored the encoding.
249+ le_bytes = struct .pack ('<e' , 1.5 )
250+ be_bytes = struct .pack ('>e' , 1.5 )
263251 b_le = array_reconstructor (array .array , 'd' , IEEE_754_FLOAT16_LE , le_bytes )
264252 b_be = array_reconstructor (array .array , 'd' , IEEE_754_FLOAT16_BE , be_bytes )
265- self .assertEqual (b_le .tolist (), [1.0 ])
266- self .assertEqual (b_be .tolist (), [1.0 ])
253+ self .assertEqual (b_le .tolist (), [1.5 ])
254+ self .assertEqual (b_be .tolist (), [1.5 ])
267255
268256 def test_unicode (self ):
269257 teststr = "Bonne Journ\xe9 e \U0002030a \U00020347 "
0 commit comments