#8112: Update the documenting xmlrpc server to use getfullargspec.

Before this patch it would raise an error when trying to display
documentation for a method that used annotations.

Patch by Claudiu Popa.
This commit is contained in:
R David Murray 2013-08-10 12:01:47 -04:00
parent 319163244a
commit f22b62e261
3 changed files with 36 additions and 11 deletions

View file

@ -756,20 +756,23 @@ class ServerHTMLDoc(pydoc.HTMLDoc):
self.escape(anchor), self.escape(name))
if inspect.ismethod(object):
args, varargs, varkw, defaults = inspect.getargspec(object)
args = inspect.getfullargspec(object)
# exclude the argument bound to the instance, it will be
# confusing to the non-Python user
argspec = inspect.formatargspec (
args[1:],
varargs,
varkw,
defaults,
args.args[1:],
args.varargs,
args.varkw,
args.defaults,
annotations=args.annotations,
formatvalue=self.formatvalue
)
elif inspect.isfunction(object):
args, varargs, varkw, defaults = inspect.getargspec(object)
args = inspect.getfullargspec(object)
argspec = inspect.formatargspec(
args, varargs, varkw, defaults, formatvalue=self.formatvalue)
args.args, args.varargs, args.varkw, args.defaults,
annotations=args.annotations,
formatvalue=self.formatvalue)
else:
argspec = '(...)'