On 14/11/13 10:57, Armin Rigo wrote:
Bah, there is another issue. The following code happens to work right now:
x, = struct.unpack("d", "ABCDxx\xff\x7f")
y = struct.pack("d", x)
assert y == "ABCDxx\xff\x7f"
This works even though x happens to be a NaN; its bit pattern is
preserved. Such an x could not be stored into a
FloatIntegerListStrategy: if it has the wrong bit pattern, we'd get
the nonsensical result that storing it in a list and reading it back
gives us suddenly an integer object with a random value...
Unsure what to do about that.
I'm tempted to say that this is an implementation detail, although for all I
know there might be some code relying on this.
If we REALLY want to support this case, we can always have a
W_FloatObjectPreservingTheBits which cannot be put in a FloatIntegerListStrategy.
W_FloatObjectPresevingTheBits will be created only by operations like
struct.unpack, cffi.cast, etc.
Not sure if it's worth the pain.
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev