This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Claudiu.Popa
Recipients Claudiu.Popa, eric.araujo, eric.snow, ncoghlan, yselivanov
Date 2015-01-17.15:19:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Yury, regarding your last message, is it actually possible to have a subclass which doesn't have a __doc__ attribute in its __dict__, except using slots? __doc__ seems to be set to None every time if it's not specified, so I don't know how could I detect the case where the client sets '__doc__ = None' himself.

The following example might be more explanatory:

>>> class A:
...    __doc__ = "a"
>>> inspect.getdoc(A)
>>> inspect.getdoc(A())
>>> class B(A):
...   __doc__ = None
>>> vars(B)
mappingproxy({'__doc__': None, '__module__': '__main__'})
>>> B.__dict__
mappingproxy({'__doc__': None, '__module__': '__main__'})
>>> class C(A): pass
>>> vars(C)
mappingproxy({'__doc__': None, '__module__': '__main__'})

Nevertheless, my patch ignores this case, since it operates only on methods. When trying to do inspect.getdoc(Child, parent=Parent), it will try to look for an attribute 'Child' in the mro of Parent and thus it will return None, since this doesn't exist (this can actually be a problem, if that attribute actually exist).
Date User Action Args
2015-01-17 15:19:58Claudiu.Popasetrecipients: + Claudiu.Popa, ncoghlan, eric.araujo, eric.snow, yselivanov
2015-01-17 15:19:58Claudiu.Popasetmessageid: <>
2015-01-17 15:19:58Claudiu.Popalinkissue15582 messages
2015-01-17 15:19:58Claudiu.Popacreate