mirror of
https://github.com/python/cpython.git
synced 2025-07-14 23:05:17 +00:00
SF bug [#472347] pydoc and properties.
The GUI-mode code to display properties blew up if the property functions (get, set, etc) weren't simply methods (or functions). "The problem" here is really that the generic document() method dispatches to one of .doc{routine, class, module, other}(), but all of those require a different(!) number of arguments. Thus document isn't general-purpose at all: you have to know exactly what kind of thing is it you're going to document first, in order to pass the correct number of arguments to .document for it to pass on. As an expedient hack, just tacked "*ignored" on to the end of the formal argument lists for the .docXXX routines so that .document's caller doesn't have to know in advance which path .document is going to take.
This commit is contained in:
parent
a6535fd40b
commit
8dd7adeb34
2 changed files with 35 additions and 3 deletions
|
@ -486,7 +486,7 @@ TT { font-family: lucidatypewriter, lucida console, courier }
|
|||
entry, modname, c)
|
||||
return '<dl>\n%s</dl>\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 @@ TT { font-family: lucidatypewriter, lucida console, courier }
|
|||
|
||||
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 @@ TT { font-family: lucidatypewriter, lucida console, courier }
|
|||
doc = doc and '<dd><tt>%s</tt></dd>' % doc
|
||||
return '<dl><dt>%s</dt>%s</dl>\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 '<strong>%s</strong> = ' % name or ''
|
||||
return lhs + self.repr(object)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue