Issue25503
Created on 2015-10-29 04:53 by jayvdb, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| getdoc-property.diff | jayvdb, 2015-10-29 04:53 | Fix and test case | review | |
| Messages (3) | |||
|---|---|---|---|
| msg253653 - (view) | Author: John Mark Vandenberg (jayvdb) * | Date: 2015-10-29 04:53 | |
inspect.getdoc's helper _finddoc raises an AttributeError on encountering a property, which is silently discarded. >>> class Foo(object): ... @property ... def foo(self): ... """foobar.""" ... return 'foo' ... >>> class Bar(Foo): ... @property ... def foo(self): ... return 'bar' ... >>> import inspect >>> inspect.getdoc(Foo.foo) 'foobar.' >>> inspect.getdoc(Bar.foo) >>> How I came upon this was doing static code analysis, and the f.fget on line 522 here looks very wrong. http://bugs.python.org/review/15582/diff/14140/Lib/inspect.py This code dedicated to supporting `property` does not work because of that, but also because a property is also a data descriptor so the 'property' branch is never executed. >>> inspect.isdatadescriptor(property()) True |
|||
| msg253659 - (view) | Author: Roundup Robot (python-dev) | Date: 2015-10-29 06:20 | |
New changeset bbf00faf25ff by Serhiy Storchaka in branch '3.5': Issue #25503: Fixed inspect.getdoc() for inherited docstrings of properties. https://hg.python.org/cpython/rev/bbf00faf25ff New changeset e80d1e9737d4 by Serhiy Storchaka in branch 'default': Issue #25503: Fixed inspect.getdoc() for inherited docstrings of properties. https://hg.python.org/cpython/rev/e80d1e9737d4 |
|||
| msg253660 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2015-10-29 06:22 | |
Thank you John for your report and your patch. Committed tests are slightly changed because "contradiction" was originally purposed to test properties. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:23 | admin | set | github: 69689 |
| 2015-10-29 06:22:55 | serhiy.storchaka | set | status: open -> closed messages: + msg253660 assignee: serhiy.storchaka |
| 2015-10-29 06:20:42 | python-dev | set | nosy:
+ python-dev messages: + msg253659 |
| 2015-10-29 04:59:16 | jayvdb | set | nosy:
+ serhiy.storchaka |
| 2015-10-29 04:53:40 | jayvdb | create | |