]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid a warning in python-eldoc-setup-code
authorCarlos Pita <carlosjosepita@gmail.com>
Mon, 4 Oct 2021 09:43:17 +0000 (11:43 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 4 Oct 2021 09:43:17 +0000 (11:43 +0200)
* lisp/progmodes/python.el (python-eldoc-setup-code): Avoid a
deprecation warning about formatargspec (bug#50996).

lisp/progmodes/python.el

index c58ac6f637d29e2d256c74e13bc286c7736dc68d..43ee3c0c152105e521a13511e1e149d9fd515c34 100644 (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