""" Bug: help() on enum34 enumeration class creates only a dummy documentation. Versions used: python 2.7.6 enum34 1.0 Platform: Windows 7 """ from enum import Enum # enum34 package class Colors(Enum): """docstring for enumeration Colors""" RED = 1 GREEN = "2" BLUE = [3] help(Colors) # The above displays: """ Help on class Colors in module __main__: Colors = """ # Fix: In pydoc.py, class TextDoc, method docclass(): # change this (on line 1220+): """ if thisclass is __builtin__.object: attrs = inherited continue elif thisclass is object: tag = "defined here" else: tag = "inherited from %s" % classname(thisclass, object.__module__) """ # to this: """ if thisclass is __builtin__.object: attrs = inherited continue elif thisclass is object: tag = "defined here" elif thisclass is None: # <-- added tag = "inherited from TBD" # <-- added else: tag = "inherited from %s" % classname(thisclass, object.__module__) """ # thisclass is None during the last round through the 'while attrs' loop. # Without the fix, this causes an AttributeError to be raised by the # classname() function, which then further on causes the dummy # documentation to be generated. # Not sure whether thisclass being None is caused by another issue, but the # fix to add a test for None at least gets it to display a reasonable # class documentation. # With this fix, the help() output will be like this: """ Help on class Colors in module __main__: class Colors(enum.Enum) | docstring for enumeration Colors | | Method resolution order: | Colors | enum.Enum | __builtin__.object | | Data and other attributes defined here: | | BLUE = | | GREEN = | | RED = | | ---------------------------------------------------------------------- | Data and other attributes TBD: | | __members__ = {'BLUE': , 'GREEN':