Avoid a warning in python-eldoc-setup-code

* lisp/progmodes/python.el (python-eldoc-setup-code): Avoid a
deprecation warning about formatargspec (bug#50996).
This commit is contained in:
Carlos Pita 2021-10-04 11:43:17 +02:00 committed by Lars Ingebrigtsen
parent 1428962590
commit 60e817e78d

View file

@ -4671,7 +4671,10 @@ See `python-check-command' for the default."
target = obj
objtype = 'def'
if target:
args = inspect.formatargspec(*argspec_function(target))
if hasattr(inspect, 'signature'):
args = str(inspect.signature(target))
else:
args = inspect.formatargspec(*argspec_function(target))
name = obj.__name__
doc = '{objtype} {name}{args}'.format(
objtype=objtype, name=name, args=args