mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
#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:
parent
319163244a
commit
f22b62e261
3 changed files with 36 additions and 11 deletions
|
|
@ -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 = '(...)'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue