Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
19d5c42
attempted fix of issue #131116. Test case failing on non changed parts
lincolnj1 Mar 12, 2025
02ec2c1
Moved new test fodder to seperate file to fix errors
lincolnj1 Mar 12, 2025
8786c3c
Cleaned workspace and actually added the changed files this time
lincolnj1 Mar 12, 2025
9fe818c
Merge branch 'python:main' into getdoc-fix
lincolnj1 Mar 12, 2025
5772f7b
Seperated new tests into new test case
lincolnj1 Mar 12, 2025
f68119e
Merge branch 'getdoc-fix' of github.com:lincolnj1/cpython into getdoc…
lincolnj1 Mar 12, 2025
2406055
📜🤖 Added by blurb_it.
blurb-it[bot] Mar 12, 2025
5f0d6d4
Merge branch 'python:main' into getdoc-fix
lincolnj1 Mar 13, 2025
d61ab34
Added more tests and versionchanged to Doc
lincolnj1 Mar 31, 2025
4b74d4e
Update Doc/library/inspect.rst
lincolnj1 Apr 1, 2025
cfe3e99
Update Lib/test/test_inspect/inspect_fodder3.py
lincolnj1 Apr 1, 2025
fa92ad3
Update Lib/test/test_inspect/inspect_fodder3.py
lincolnj1 Apr 1, 2025
d83205c
Update Lib/test/test_inspect/inspect_fodder3.py
lincolnj1 Apr 1, 2025
c4764ff
Update Lib/test/test_inspect/inspect_fodder3.py
lincolnj1 Apr 1, 2025
1b0471f
Fixed inspect_fodder3 comments and added new test cases
lincolnj1 Apr 10, 2025
d4e37c3
Merge branch 'main' into getdoc-fix
serhiy-storchaka Nov 12, 2025
1e0cb4b
Apply suggestions from code review
serhiy-storchaka Nov 12, 2025
a669d23
Update Lib/test/test_inspect/test_inspect.py
serhiy-storchaka Nov 12, 2025
c510524
Apply suggestions from code review
serhiy-storchaka Nov 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
attempted fix of issue #131116. Test case failing on non changed parts
  • Loading branch information
lincolnj1 committed Mar 12, 2025
commit 19d5c42b09a57c5d93ee9cd391ab21b8ea55ba90
6 changes: 6 additions & 0 deletions Lib/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,12 @@ def _finddoc(obj):
cls = _findclass(obj.fget)
if cls is None or getattr(cls, name) is not obj:
return None
# Should be tested before ismethoddescriptor()
elif isinstance(obj, functools.cached_property):
name = obj.attrname
cls = _findclass(obj.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__
Expand Down
10 changes: 10 additions & 0 deletions Lib/test/test_inspect/inspect_fodder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'A module docstring.'

import inspect
from functools import cached_property
# line 5

# line 7
Expand Down Expand Up @@ -50,6 +51,11 @@ def contradiction(self):
'The automatic gainsaying.'
pass

@cached_property
def foo(self):
"StupidGit.foo docstring"
pass

# line 53
class MalodorousPervert(StupidGit):
def abuse(self, a, b, c):
Expand All @@ -59,6 +65,10 @@ def abuse(self, a, b, c):
def contradiction(self):
pass

@cached_property
def foo(self):
pass

Tit = MalodorousPervert

class ParrotDroppings:
Expand Down
3 changes: 3 additions & 0 deletions Lib/test/test_inspect/test_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,9 @@ def test_getdoc(self):
'measured in kilowatts')
self.assertEqual(inspect.getdoc(SlotUser.distance),
'measured in kilometers')
print('new test', file=sys.stderr)
self.assertEqual(inspect.getdoc(mod.MalodorousPervert.foo),
inspect.getdoc(mod.StupidGit.foo))

@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
Expand Down