diff -r ad92e63de42c Lib/inspect.py
--- a/Lib/inspect.py Thu Feb 20 23:26:12 2014 +0100
+++ b/Lib/inspect.py Thu Feb 20 16:27:14 2014 -0800
@@ -88,8 +88,12 @@
Instance method objects provide these attributes:
__doc__ documentation string
__name__ name with which this method was defined
- __func__ function object containing implementation of method
- __self__ instance to which this method is bound"""
+ __self__ instance to which this method is bound
+ Non-builtin instance method objects also provide this attribute:
+ __func__ function object containing implementation of method"""
+ if isbuiltin(object):
+ self = getattr(object, '__self__', False)
+ return bool(self and (not isinstance(self, types.ModuleType)))
return isinstance(object, types.MethodType)
def ismethoddescriptor(object):
diff -r ad92e63de42c Lib/pydoc.py
--- a/Lib/pydoc.py Thu Feb 20 23:26:12 2014 +0100
+++ b/Lib/pydoc.py Thu Feb 20 16:27:14 2014 -0800
@@ -909,7 +909,6 @@
object.__self__.__class__, mod)
else:
note = ' unbound %s method' % self.classlink(imclass,mod)
- object = object.__func__
if name == realname:
title = '%s' % (anchor, realname)
@@ -924,7 +923,7 @@
title = '%s = %s' % (
anchor, name, reallink)
argspec = None
- if inspect.isfunction(object) or inspect.isbuiltin(object):
+ if inspect.isroutine(object):
try:
signature = inspect.signature(object)
except (ValueError, TypeError):
@@ -1315,7 +1314,6 @@
object.__self__.__class__, mod)
else:
note = ' unbound %s method' % classname(imclass,mod)
- object = object.__func__
if name == realname:
title = self.bold(realname)