bpo-33911: Fixed deprecation warning in xmlrpc.server (GH-7847)
Replace deprecated inspect.getfullargspec() with inspect.signature().
This commit is contained in:
parent
bd47384e07
commit
35c0809158
|
@ -107,13 +107,13 @@ server.handle_request()
|
||||||
from xmlrpc.client import Fault, dumps, loads, gzip_encode, gzip_decode
|
from xmlrpc.client import Fault, dumps, loads, gzip_encode, gzip_decode
|
||||||
from http.server import BaseHTTPRequestHandler
|
from http.server import BaseHTTPRequestHandler
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
from inspect import signature
|
||||||
import http.server
|
import http.server
|
||||||
import socketserver
|
import socketserver
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import pydoc
|
import pydoc
|
||||||
import inspect
|
|
||||||
import traceback
|
import traceback
|
||||||
try:
|
try:
|
||||||
import fcntl
|
import fcntl
|
||||||
|
@ -771,24 +771,8 @@ class ServerHTMLDoc(pydoc.HTMLDoc):
|
||||||
title = '<a name="%s"><strong>%s</strong></a>' % (
|
title = '<a name="%s"><strong>%s</strong></a>' % (
|
||||||
self.escape(anchor), self.escape(name))
|
self.escape(anchor), self.escape(name))
|
||||||
|
|
||||||
if inspect.ismethod(object):
|
if callable(object):
|
||||||
args = inspect.getfullargspec(object)
|
argspec = str(signature(object))
|
||||||
# exclude the argument bound to the instance, it will be
|
|
||||||
# confusing to the non-Python user
|
|
||||||
argspec = inspect.formatargspec (
|
|
||||||
args.args[1:],
|
|
||||||
args.varargs,
|
|
||||||
args.varkw,
|
|
||||||
args.defaults,
|
|
||||||
annotations=args.annotations,
|
|
||||||
formatvalue=self.formatvalue
|
|
||||||
)
|
|
||||||
elif inspect.isfunction(object):
|
|
||||||
args = inspect.getfullargspec(object)
|
|
||||||
argspec = inspect.formatargspec(
|
|
||||||
args.args, args.varargs, args.varkw, args.defaults,
|
|
||||||
annotations=args.annotations,
|
|
||||||
formatvalue=self.formatvalue)
|
|
||||||
else:
|
else:
|
||||||
argspec = '(...)'
|
argspec = '(...)'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue