diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 1e333398b88..911291b2e8f 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -486,7 +486,7 @@ def formattree(self, tree, modname, parent=None): entry, modname, c) return '
\n%s
\n' % result - def docmodule(self, object, name=None, mod=None): + def docmodule(self, object, name=None, mod=None, *ignored): """Produce HTML documentation for a module object.""" name = object.__name__ # ignore the passed-in name parts = split(name, '.') @@ -601,7 +601,8 @@ def docmodule(self, object, name=None, mod=None): return result - def docclass(self, object, name=None, mod=None, funcs={}, classes={}): + def docclass(self, object, name=None, mod=None, funcs={}, classes={}, + *ignored): """Produce HTML documentation for a class object.""" realname = object.__name__ name = name or realname @@ -800,7 +801,7 @@ def docroutine(self, object, name=None, mod=None, doc = doc and '
%s
' % doc return '
%s
%s
\n' % (decl, doc) - def docother(self, object, name=None, mod=None): + def docother(self, object, name=None, mod=None, *ignored): """Produce HTML documentation for a data object.""" lhs = name and '%s = ' % name or '' return lhs + self.repr(object) diff --git a/Lib/test/pydocfodder.py b/Lib/test/pydocfodder.py index 7ccac5e40ff..becdf2250e8 100644 --- a/Lib/test/pydocfodder.py +++ b/Lib/test/pydocfodder.py @@ -177,3 +177,34 @@ def CD_method(self): "Method defined in C and D." def D_method(self): "Method defined in D." + +class FunkyProperties(object): + """From SF bug 472347, by Roeland Rengelink. + + Property getters etc may not be vanilla functions or methods, + and this used to make GUI pydoc blow up. + """ + + def __init__(self): + self.desc = {'x':0} + + class get_desc: + def __init__(self, attr): + self.attr = attr + def __call__(self, inst): + print 'Get called', self, inst + return inst.desc[self.attr] + class set_desc: + def __init__(self, attr): + self.attr = attr + def __call__(self, inst, val): + print 'Set called', self, inst, val + inst.desc[self.attr] = val + class del_desc: + def __init__(self, attr): + self.attr = attr + def __call__(self, inst): + print 'Del called', self, inst + del inst.desc[self.attr] + + x = property(get_desc('x'), set_desc('x'), del_desc('x'), 'prop x')