[pypy-issue] Issue #2145: lib-python/2.7/test/test_long.py fails on ppc-updated-backend branch (pypy/pypy)

Vaibhav Sood issues-reply at bitbucket.org
Fri Sep 25 14:01:10 CEST 2015


New issue 2145: lib-python/2.7/test/test_long.py fails on ppc-updated-backend branch
https://bitbucket.org/pypy/pypy/issues/2145/lib-python-27-test-test_longpy-fails-on

Vaibhav Sood:

Hi,

I tried running lib-python/2.7/test/test_long.py on the 'ppc-updated-backend' branch and it fails with the following error:

FAIL: test_mixed_compares (test.test_long.LongTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/test/vaibhav/pypy/lib-python/2.7/test/test_long.py", line 864, in test_mixed_compares
    eq(Rcmp, xycmp, Frm("%r %r %d %d", x, y, Rcmp, xycmp))
AssertionError: 9223372036854775807 9.223372036854776e+18 -1 0

----------------------------------------------------------------------

I tried investigating the issue, the error seems to be due to floating point comparison between a float and a long not being handled correctly in pypy on ppc

On a x86 machine: 

vaibhav at vaibhav-VirtualBox:~/work-code/pypy$ pypy
Python 2.7.3 (2.2.1+dfsg-1ubuntu0.2, Dec 02 2014, 23:00:55)
[PyPy 2.2.1 with GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``in PyPy being only moderately
magic is a good thing <cfbolz>''
>>>> import sys
>>>> from decimal import Decimal
>>>> Decimal(sys.maxint), Decimal(float(sys.maxint))
(Decimal('9223372036854775807'), Decimal('9223372036854775808'))
>>>> sys.maxint == float(sys.maxint)
False
>>>> 


On a ppc64le machine:

test at pts00449-vm9:~/vaibhav/pypy$ pypy
Python 2.7.6 (2.3.1+dfsg-1, Jun 10 2014, 17:11:35)
[PyPy 2.3.1 with GCC 4.9.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>> import sys
>>>> from decimal import Decimal
>>>> Decimal(sys.maxint), Decimal(float(sys.maxint))
(Decimal('9223372036854775807'), Decimal('9223372036854775808'))
>>>> sys.maxint == float(sys.maxint)
True
>>>>

So on a PowerPC the overflow caused by float(sys.maxint) is not handled correctly




More information about the pypy-issue mailing list