Commits

Georg Brandl committed c7f1e36

Add a fix for objects whose getattr adds new members to __dict__.

Comments (0)

Files changed (1)

sphinx/ext/autodoc.py

         else:
             # __dict__ contains only the members directly defined in
             # the class (but get them via getattr anyway, to e.g. get
-            # unbound method objects instead of function objects)
+            # unbound method objects instead of function objects);
+            # using keys() because apparently there are objects for which
+            # __dict__ changes while getting attributes
             return False, sorted([
                 (mname, self.get_attr(self.object, mname))
-                for mname in self.get_attr(self.object, '__dict__')])
+                for mname in self.get_attr(self.object, '__dict__').keys()])
 
     def filter_members(self, members, want_all):
         """