[issue16938] pydoc confused by __dir__

Ethan Furman report at bugs.python.org
Sun Oct 13 20:04:32 CEST 2013


Ethan Furman added the comment:

That portion of classify_class_attrs now reads:

    else:
        homecls = getattr(get_obj, "__objclass__", None)
        if homecls not in possible_bases:
            # if the resulting object does not live somewhere in the
            # mro, drop it and go with the dict_obj version only
            homecls = None
            get_obj = sentinel

An example for why the if clause is still there:

    class Life:
        @property
        def answer(self):
            return 42

Without the if clause the home class for answer would be int when it should be Life.

Attached patch is refactored for simplicity as well.

----------
Added file: http://bugs.python.org/file32092/issue16938.stoneleaf.02.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16938>
_______________________________________


More information about the Python-bugs-list mailing list