summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas NoƩ <nicolas@niconoe.org>2018-07-16 08:46:04 (GMT)
committerVictor Stinner <vstinner@redhat.com>2018-07-16 08:46:04 (GMT)
commit35c0809158be7feae4c4f877a08b93baea2d8291 (patch)
tree4f48d46420e1261fdbb7e5da6027c8e2eb1db331
parentbd47384e07bde38a8f18b90b4cea02a505d95c75 (diff)
downloadcpython-35c0809158be7feae4c4f877a08b93baea2d8291.zip
cpython-35c0809158be7feae4c4f877a08b93baea2d8291.tar.gz
cpython-35c0809158be7feae4c4f877a08b93baea2d8291.tar.bz2
bpo-33911: Fixed deprecation warning in xmlrpc.server (GH-7847)
Replace deprecated inspect.getfullargspec() with inspect.signature().
-rw-r--r--Lib/xmlrpc/server.py22
1 files changed, 3 insertions, 19 deletions
diff --git a/Lib/xmlrpc/server.py b/Lib/xmlrpc/server.py
index 88d0eec..f1c467e 100644
--- a/Lib/xmlrpc/server.py
+++ b/Lib/xmlrpc/server.py
@@ -107,13 +107,13 @@ server.handle_request()
from xmlrpc.client import Fault, dumps, loads, gzip_encode, gzip_decode
from http.server import BaseHTTPRequestHandler
from functools import partial
+from inspect import signature
import http.server
import socketserver
import sys
import os
import re
import pydoc
-import inspect
import traceback
try:
import fcntl
@@ -771,24 +771,8 @@ class ServerHTMLDoc(pydoc.HTMLDoc):
title = '<a name="%s"><strong>%s</strong></a>' % (
self.escape(anchor), self.escape(name))
- if inspect.ismethod(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.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)
+ if callable(object):
+ argspec = str(signature(object))
else:
argspec = '(...)'