Hi everyone, I'd like to report a compatibility issue between CPython and PyPy in the fractions module. In short, CPython coerces Fraction objects into int's in strings formatted with "%d", but PyPy throws a TypeError. Here's an example reproducing this:
~/Downloads/pypy-2.2.1-linux64/bin$ ./pypy Python 2.7.3 (87aa9de10f9c, Nov 24 2013, 18:48:13) [PyPy 2.2.1 with GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. And now for something completely different: ``<arigato> fijal: I'm sure there is tons of unspecified context information that I should ideally also be aware of'' >>>> from fractions import Fraction >>>> print "%d" % Fraction(1, 1) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type for int(): 'Fraction' >>>> ~/Downloads/pypy-2.2.1-linux64/bin$ python Python 2.7.3 (default, Feb 27 2014, 19:37:34) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from fractions import Fraction >>> print "%d" % Fraction(1, 1) 1 >>> Thanks for the great work you all do! Naftali
_______________________________________________ pypy-dev mailing list [email protected] https://mail.python.org/mailman/listinfo/pypy-dev
