[pypy-commit] pypy default: merged upstream.
alex_gaynor
noreply at buildbot.pypy.org
Mon Jun 27 22:57:26 CEST 2011
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch:
Changeset: r45150:42dd6ee24f03
Date: 2011-06-27 14:03 -0700
http://bitbucket.org/pypy/pypy/changeset/42dd6ee24f03/
Log: merged upstream.
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
@@ -203,3 +203,16 @@
lst = seen[:]
assert lst == [5, 10, 2]
raises(OSError, os.lseek, fd, 7, 0)
+
+ def test_method_attrs(self):
+ class A(object):
+ def m(self):
+ "aaa"
+ m.x = 3
+
+ bm = A().m
+ assert bm.__func__ is bm.im_func
+ assert bm.__self__ is bm.im_self
+ 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
@@ -761,12 +761,15 @@
)
Function.typedef.acceptable_as_base_class = False
-Method.typedef = TypeDef("method",
+Method.typedef = TypeDef(
+ "method",
__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),
im_class = interp_attrproperty_w('w_class', cls=Method),
__getattribute__ = interp2app(Method.descr_method_getattribute),
__eq__ = interp2app(Method.descr_method_eq),
More information about the pypy-commit
mailing list