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:18:46 2014 -0800 @@ -88,8 +88,11 @@ 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): + return bool(getattr(object, '__self__', False)) 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:18:46 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) diff -r ad92e63de42c Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py Thu Feb 20 23:26:12 2014 +0100 +++ b/Lib/test/test_pydoc.py Thu Feb 20 16:18:46 2014 -0800 @@ -704,7 +704,7 @@ # test producing signatures from builtins stat_sig = pydoc.render_doc(os.stat) self.assertEqual(pydoc.plain(stat_sig).splitlines()[2], - 'stat(path, *, dir_fd=None, follow_symlinks=True)') + 'stat(path, *, dir_fd=None, follow_symlinks=True) method of builtins.module instance') @unittest.skipUnless(threading, 'Threading required for this test.')