[Python-checkins] bpo-33911: Fixed deprecation warning in xmlrpc.server (GH-7847)
Victor Stinner
webhook-mailer at python.org
Mon Jul 16 04:46:16 EDT 2018
https://github.com/python/cpython/commit/35c0809158be7feae4c4f877a08b93baea2d8291
commit: 35c0809158be7feae4c4f877a08b93baea2d8291
branch: master
author: Nicolas Noé <nicolas at niconoe.org>
committer: Victor Stinner <vstinner at redhat.com>
date: 2018-07-16T10:46:04+02:00
summary:
bpo-33911: Fixed deprecation warning in xmlrpc.server (GH-7847)
Replace deprecated inspect.getfullargspec() with inspect.signature().
files:
M Lib/xmlrpc/server.py
diff --git a/Lib/xmlrpc/server.py b/Lib/xmlrpc/server.py
index 88d0eec786b0..f1c467eb1b2b 100644
--- a/Lib/xmlrpc/server.py
+++ b/Lib/xmlrpc/server.py
@@ -107,13 +107,13 @@ def export_add(self, x, y):
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 @@ def docroutine(self, object, name, mod=None,
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 = '(...)'
More information about the Python-checkins
mailing list