Claudiu Popa added the comment: 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) 'a' >>> inspect.getdoc(A()) '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). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15582> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com