Message253653
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 |
|
Date |
User |
Action |
Args |
2015-10-29 04:53:40 | jayvdb | set | recipients:
+ jayvdb |
2015-10-29 04:53:40 | jayvdb | set | messageid: <1446094420.64.0.595919822106.issue25503@psf.upfronthosting.co.za> |
2015-10-29 04:53:40 | jayvdb | link | issue25503 messages |
2015-10-29 04:53:39 | jayvdb | create | |
|