@@ -107,13 +107,13 @@ def export_add(self, x, y):
107
107
from xmlrpc .client import Fault , dumps , loads , gzip_encode , gzip_decode
108
108
from http .server import BaseHTTPRequestHandler
109
109
from functools import partial
110
+ from inspect import signature
110
111
import http .server
111
112
import socketserver
112
113
import sys
113
114
import os
114
115
import re
115
116
import pydoc
116
- import inspect
117
117
import traceback
118
118
try :
119
119
import fcntl
@@ -771,24 +771,8 @@ def docroutine(self, object, name, mod=None,
771
771
title = '<a name="%s"><strong>%s</strong></a>' % (
772
772
self .escape (anchor ), self .escape (name ))
773
773
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 ))
792
776
else :
793
777
argspec = '(...)'
794
778
0 commit comments