Commits

A. Jesse Jiryu Davis committed 6b7659a

Respect add_autodoc_attrgetter() even when inherited-members is set

  • Participants
  • Parent commits be7fe90

Comments (0)

Files changed (2)

File sphinx/ext/autodoc.py

         elif self.options.inherited_members:
             # safe_getmembers() uses dir() which pulls in members from all
             # base classes
-            members = safe_getmembers(self.object)
+            members = safe_getmembers(self.object, attr_getter=self.get_attr)
         else:
             # __dict__ contains only the members directly defined in
             # the class (but get them via getattr anyway, to e.g. get

File sphinx/util/inspect.py

         raise AttributeError(name)
 
 
-def safe_getmembers(object, predicate=None):
+def safe_getmembers(object, predicate=None, attr_getter=safe_getattr):
     """A version of inspect.getmembers() that uses safe_getattr()."""
     results = []
     for key in dir(object):
         try:
-            value = safe_getattr(object, key, None)
+            value = attr_getter(object, key, None)
         except AttributeError:
             continue
         if not predicate or predicate(value):