[pypy-issue] [issue1738] struct.unpack incompatibility with cpython

Armin Rigo tracker at bugs.pypy.org
Sat Apr 19 10:29:08 CEST 2014


Armin Rigo <armin.rigo at gmail.com> added the comment:

Note that the CPython return type depends on the input data:

    >>> struct.unpack("!Q", "\x00"*8)
    (0,)
    >>> struct.unpack("!Q", "\xff"*8)
    (18446744073709551615L,)

Is it really something we need to reproduce in PyPy?  PyPy's behavior is at
least more consistent, because the return type depends only on the format
character...  Can you give us an example of Python code that depends on that
(and doesn't break horribly when it *does* get a long)?

----------
nosy: +arigo

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1738>
________________________________________


More information about the pypy-issue mailing list