8000 bpo-33911: Fixed deprecation warning in xmlrpc.server (GH-7847) · python/cpython@35c0809 · GitHub
[go: up one dir, main page]

Skip to content

Commit 35c0809

Browse files
Nicolas Noévstinner
Nicolas Noé
authored andcommitted
bpo-33911: Fixed deprecation warning in xmlrpc.server (GH-7847)
Replace deprecated inspect.getfullargspec() with inspect.signature().
1 parent bd47384 commit 35c0809

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

Lib/xmlrpc/server.py

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ def export_add(self, x, y):
107107
from xmlrpc.client import Fault, dumps, loads, gzip_encode, gzip_decode
108108
from http.server import BaseHTTPRequestHandler
109109
from functools import partial
110+
from inspect import signature
110111
import http.server
111112
import socketserver
112113
import sys
113114
import os
114115
import re
115116
import pydoc
116-
import inspect
117117
import traceback
118118
try:
119119
import fcntl
@@ -771,24 +771,8 @@ def docroutine(self, object, name, mod=None,
771771
title = '<a name="%s"><strong>%s</strong></a>' % (
772772
self.escape(anchor), self.escape(name))
773773

774-
if inspect.ismethod(object):
775-
args = inspect.getfullargspec(object)
776-
# exclude the argument bound to the instance, it will be
777-
# confusing to the non-Python user
778-
argspec = inspect.formatargspec (
779-
args.args[1:],
780-
args.varargs,
781-
args.varkw,
782-
args.defaults,
783-
annotations=args.annotations,
784-
formatvalue=self.formatvalue
785-
)
786-
elif inspect.isfunction(object):
787-
args = inspect.getfullargspec(object)
788-
argspec = inspect.formatargspec(
789-
args.args, args.varargs, args.varkw, args.defaults,
790-
annotations=args.annotations,
791-
formatvalue=self.formatvalue)
774+
if callable(object):
775+
argspec = str(signature(object))
792776
else:
793777
argspec = '(...)'
794778

0 commit comments

Comments
 (0)
0