[pypy-commit] pypy default: Bug and fix.

arigo noreply at buildbot.pypy.org
Tue May 17 15:50:04 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r44249:79205a147ee3
Date: 2011-05-17 15:59 +0200
http://bitbucket.org/pypy/pypy/changeset/79205a147ee3/

Log:	Bug and fix.

diff --git a/pypy/objspace/std/inttype.py b/pypy/objspace/std/inttype.py
--- a/pypy/objspace/std/inttype.py
+++ b/pypy/objspace/std/inttype.py
@@ -179,7 +179,7 @@
     return space.wrap(1)
 
 def descr_get_real(space, w_obj):
-    return w_obj
+    return space.int(w_obj)
 
 def descr_get_imag(space, w_obj):
     return space.wrap(0)
diff --git a/pypy/objspace/std/test/test_intobject.py b/pypy/objspace/std/test/test_intobject.py
--- a/pypy/objspace/std/test/test_intobject.py
+++ b/pypy/objspace/std/test/test_intobject.py
@@ -480,6 +480,11 @@
         ]:
             assert val.bit_length() == bits
 
+    def test_int_real(self):
+        class A(int): pass
+        b = A(5).real
+        assert type(b) is int
+
 
 class AppTestIntOptimizedAdd(AppTestInt):
     def setup_class(cls):


More information about the pypy-commit mailing list