Hi Antonio, On Thu, Nov 14, 2013 at 2:35 PM, Antonio Cuni <anto.c...@gmail.com> wrote: > W_FloatObjectPresevingTheBits will be created only by operations like > struct.unpack, cffi.cast, etc.
That's not enough: if you read one such float into a variable and then append that variable into another list, then the other list also needs to record the fact that it contains special NaNs. It seems we could pick the following solution instead: keep FloatStrategy, storing a RPython list of floats --- including possibly special NaNs; and add FloatIntStrategy, which cannot store special NaNs. We check for the special NaNs when we add into a FloatIntStrategy list, and when converting from FloatStrategy to FloatIntStrategy. For the latter case we do indeed need to check all items, which sounds a bit pointless, but (1) this is already a good progress over the current situation, which is that we need to allocate a W_FloatObject per item and a new RPython list to hold them; and (2) doing the check over all items upon conversion is actually the same total amount of work as it would be if we checked each item as it was added to the FloatStrategy list. (Fwiw, I'm also fond of the idea that it should actually be a "FloatIntNoneStrategy"; it would improve the situation even for lists of int-or-None.) A bientôt, Armin. _______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev