Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue25503

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:inspect.getdoc does find inherited property __doc__
Type:behaviorStage:resolved
Components:Library (Lib)Versions:Python 3.6, Python 3.5
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To: serhiy.storchakaNosy List: jayvdb, python-dev, serhiy.storchaka
Priority:normalKeywords:patch

Created on2015-10-29 04:53 byjayvdb, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
getdoc-property.diffjayvdb,2015-10-29 04:53Fix and test casereview
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.pyThis 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)(Python triager)Date: 2015-10-29 06:20
New changesetbbf00faf25ff by Serhiy Storchaka in branch '3.5':Issue#25503: Fixed inspect.getdoc() for inherited docstrings of properties.https://hg.python.org/cpython/rev/bbf00faf25ffNew changesete80d1e9737d4 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)*(Python committer)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
DateUserActionArgs
2022-04-11 14:58:23adminsetgithub: 69689
2015-10-29 06:22:55serhiy.storchakasetstatus: open -> closed
messages: +msg253660

assignee:serhiy.storchaka
resolution: fixed
stage: resolved
2015-10-29 06:20:42python-devsetnosy: +python-dev
messages: +msg253659
2015-10-29 04:59:16jayvdbsetnosy: +serhiy.storchaka
2015-10-29 04:53:40jayvdbcreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp