@@ -107,13 +107,13 @@ def export_add(self, x, y):
107107from xmlrpc .client import Fault , dumps , loads , gzip_encode , gzip_decode
108108from http .server import BaseHTTPRequestHandler
109109from functools import partial
110+ from inspect import signature
110111import http .server
111112import socketserver
112113import sys
113114import os
114115import re
115116import pydoc
116- import inspect
117117import traceback
118118try :
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