[pypy-commit] pypy py3k: fix bin() and its test

antocuni noreply at buildbot.pypy.org
Fri Feb 24 15:12:05 CET 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r52860:7ca5d4566fbf
Date: 2012-02-24 14:59 +0100
http://bitbucket.org/pypy/pypy/changeset/7ca5d4566fbf/

Log:	fix bin() and its test

diff --git a/pypy/module/__builtin__/app_operation.py b/pypy/module/__builtin__/app_operation.py
--- a/pypy/module/__builtin__/app_operation.py
+++ b/pypy/module/__builtin__/app_operation.py
@@ -1,4 +1,4 @@
 def bin(x):
-    if not isinstance(x, (int, long)):
-        raise TypeError("must be int or long")
+    if not isinstance(x, int):
+        raise TypeError("%s object cannot be interpreted as an integer" % type(x))
     return x.__format__("#b")
diff --git a/pypy/module/__builtin__/test/test_builtin.py b/pypy/module/__builtin__/test/test_builtin.py
--- a/pypy/module/__builtin__/test/test_builtin.py
+++ b/pypy/module/__builtin__/test/test_builtin.py
@@ -79,8 +79,8 @@
     def test_bin(self):
         assert bin(0) == "0b0"
         assert bin(-1) == "-0b1"
-        assert bin(2L) == "0b10"
-        assert bin(-2L) == "-0b10"
+        assert bin(2) == "0b10"
+        assert bin(-2) == "-0b10"
         raises(TypeError, bin, 0.)
 
     def test_chr(self):


More information about the pypy-commit mailing list