[pypy-commit] pypy py3k: kill the attributes im_self and im_func from Method objects, in py3k they have been replaced by __self__ and __func__. I expect some tests to fail because of this, I'll let buildbot to find them :-)

antocuni noreply at buildbot.pypy.org
Tue Feb 21 10:50:48 CET 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r52711:b18b2fc21ef3
Date: 2012-02-21 10:06 +0100
http://bitbucket.org/pypy/pypy/changeset/b18b2fc21ef3/

Log:	kill the attributes im_self and im_func from Method objects, in py3k
	they have been replaced by __self__ and __func__. I expect some
	tests to fail because of this, I'll let buildbot to find them :-)

diff --git a/pypy/interpreter/test/test_function.py b/pypy/interpreter/test/test_function.py
--- a/pypy/interpreter/test/test_function.py
+++ b/pypy/interpreter/test/test_function.py
@@ -97,7 +97,7 @@
         def f(*args):
             return 42
         raises(TypeError, "dir.func_code = f.func_code")
-        raises(TypeError, "list().append.im_func.func_code = f.func_code")
+        raises(TypeError, "list().append.__func__.func_code = f.func_code")
 
     def test_set_module_to_name_eagerly(self):
         skip("fails on PyPy but works on CPython.  Unsure we want to care")
diff --git a/pypy/interpreter/test/test_typedef.py b/pypy/interpreter/test/test_typedef.py
--- a/pypy/interpreter/test/test_typedef.py
+++ b/pypy/interpreter/test/test_typedef.py
@@ -337,10 +337,10 @@
         class B(A):
             pass
 
-        bm = B().m
-        assert bm.__func__ is bm.im_func
-        assert bm.__self__ is bm.im_self
-        assert bm.im_class is B
+        obj = B()
+        bm = obj.m
+        assert bm.__func__ is A.m
+        assert bm.__self__ is obj
         assert bm.__doc__ == "aaa"
         assert bm.x == 3
         raises(AttributeError, setattr, bm, 'x', 15)
diff --git a/pypy/interpreter/typedef.py b/pypy/interpreter/typedef.py
--- a/pypy/interpreter/typedef.py
+++ b/pypy/interpreter/typedef.py
@@ -795,9 +795,7 @@
     __new__ = interp2app(Method.descr_method__new__.im_func),
     __call__ = interp2app(Method.descr_method_call),
     __get__ = interp2app(Method.descr_method_get),
-    im_func  = interp_attrproperty_w('w_function', cls=Method),
     __func__ = interp_attrproperty_w('w_function', cls=Method),
-    im_self  = interp_attrproperty_w('w_instance', cls=Method),
     __self__ = interp_attrproperty_w('w_instance', cls=Method),
     __getattribute__ = interp2app(Method.descr_method_getattribute),
     __eq__ = interp2app(Method.descr_method_eq),


More information about the pypy-commit mailing list