diff -r 13be42829771 Lib/inspect.py --- a/Lib/inspect.py Wed Oct 28 03:15:38 2015 -0400 +++ b/Lib/inspect.py Thu Oct 29 15:50:20 2015 +1100 @@ -527,17 +527,17 @@ cls = self else: cls = self.__class__ + elif isinstance(obj, property): + func = obj.fget + name = func.__name__ + cls = _findclass(func) + if cls is None or getattr(cls, name) is not obj: + return None elif ismethoddescriptor(obj) or isdatadescriptor(obj): name = obj.__name__ cls = obj.__objclass__ if getattr(cls, name) is not obj: return None - elif isinstance(obj, property): - func = f.fget - name = func.__name__ - cls = _findclass(func) - if cls is None or getattr(cls, name) is not obj: - return None else: return None diff -r 13be42829771 Lib/test/inspect_fodder.py --- a/Lib/test/inspect_fodder.py Wed Oct 28 03:15:38 2015 -0400 +++ b/Lib/test/inspect_fodder.py Thu Oct 29 15:50:20 2015 +1100 @@ -49,12 +49,21 @@ 'The automatic gainsaying.' pass -# line 48 + @property + def obscure(self): + """The underlying truth.""" + pass + + +# line 58 class MalodorousPervert(StupidGit): def abuse(self, a, b, c): pass def contradiction(self): pass + @property + def obscure(self): + pass Tit = MalodorousPervert diff -r 13be42829771 Lib/test/test_inspect.py --- a/Lib/test/test_inspect.py Wed Oct 28 03:15:38 2015 -0400 +++ b/Lib/test/test_inspect.py Thu Oct 29 15:50:20 2015 +1100 @@ -359,6 +359,8 @@ 'Another\n\ndocstring\n\ncontaining\n\ntabs') self.assertEqual(inspect.getdoc(mod.FesteringGob.contradiction), 'The automatic gainsaying.') + self.assertEqual(inspect.getdoc(mod.FesteringGob.obscure), + 'The underlying truth.') @unittest.skipIf(MISSING_C_DOCSTRINGS, "test requires docstrings") def test_finddoc(self): @@ -393,8 +395,8 @@ def test_getsource(self): self.assertSourceEqual(git.abuse, 29, 39) - self.assertSourceEqual(mod.StupidGit, 21, 50) - self.assertSourceEqual(mod.lobbest, 70, 71) + self.assertSourceEqual(mod.StupidGit, 21, 55) + self.assertSourceEqual(mod.lobbest, 79, 80) def test_getsourcefile(self): self.assertEqual(normcase(inspect.getsourcefile(mod.spam)), modfile)