Author: Armin Rigo <[email protected]>
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):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to