[pypy-svn] r16420 - pypy/dist/pypy/interpreter
arigo at codespeak.net
arigo at codespeak.net
Wed Aug 24 19:17:48 CEST 2005
Author: arigo
Date: Wed Aug 24 19:17:45 2005
New Revision: 16420
Modified:
pypy/dist/pypy/interpreter/function.py
Log:
Fix for test_class:
* always delegate the __doc__ attribute from the method to the underlying
function
* should not call space.lookup() from the interpreter/ directory -- unless
we review this policy at some later point(?).
Modified: pypy/dist/pypy/interpreter/function.py
==============================================================================
--- pypy/dist/pypy/interpreter/function.py (original)
+++ pypy/dist/pypy/interpreter/function.py Wed Aug 24 19:17:45 2005
@@ -279,12 +279,15 @@
def descr_method_getattribute(self, w_attr):
space = self.space
- w_self = space.wrap(self)
- w_result = space.lookup(w_self, space.str_w(w_attr))
- if w_result is None:
- return space.getattr(self.w_function, w_attr)
- else:
- return space.get(w_result, w_self)
+ if space.str_w(w_attr) != '__doc__':
+ try:
+ return space.call_method(space.w_object, '__getattribute__',
+ space.wrap(self), w_attr)
+ except OperationError, e:
+ if not e.match(space, space.w_AttributeError):
+ raise
+ # fall-back to the attribute of the underlying 'im_func'
+ return space.getattr(self.w_function, w_attr)
def descr_method_eq(self, w_other):
space = self.space
More information about the Pypy-commit
mailing list