New issue 2378: NaN with payload in struct.(un)pack with endian-ness given
https://bitbucket.org/pypy/pypy/issues/2378/nan-with-payload-in-struct-un-pack-with

llvtt:

PyPy3 does not appear to handle NaN with a payload when calling struct.pack or 
struct.unpack if endianness is given as part of the format string:


```
#!python

import struct

# result: b'\x12\x00\x00\x00\x00\x00\xf8\x7f'
struct.pack('d', struct.unpack('d', b'\x12\x00\x00\x00\x00\x00\xf8\x7f')[0])
# result: b'\x00\x00\x00\x00\x00\x00\xf8\x7f' (starts with b'\x00' instead of 
b'x\12')
struct.pack('d', struct.unpack('<d', b'\x12\x00\x00\x00\x00\x00\xf8\x7f')[0])

```

```
$ pypy3 --version
Python 3.2.5 (b2091e973da69152b3f928bfaabd5d2347e6df46, Sep 23 2015, 09:21:00)
[PyPy 2.4.0 with GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.72)]
```

PyPy2 does not appear to have this behavior (NaN payload is part of the output 
whether endian-ness is specified or not).


_______________________________________________
pypy-issue mailing list
pypy-issue@python.org
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to