]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve python3-compatibility of fallback completion (Bug#28499)
authorJoerg Behrmann <behrmann@physik.fu-berlin.de>
Mon, 18 Sep 2017 14:59:49 +0000 (16:59 +0200)
committerNoam Postavsky <npostavs@gmail.com>
Mon, 25 Sep 2017 23:39:19 +0000 (19:39 -0400)
* lisp/progmodes/python.el (python-eldoc-setup-code): Use
inspect.getfullargspec instead of inspect.getargspec to avoid a
deprecation warning on every usage of eldoc in python-mode.

Copyright-paperwork-exempt: yes

lisp/progmodes/python.el

index f3513ced4bbbd2963368a87e1e9c143d135f08d5..365191c56b02a42f2899ae9c83a40cc33b9dc6fe 100644 (file)
@@ -4271,8 +4271,10 @@ See `python-check-command' for the default."
         import inspect
         try:
             str_type = basestring
+            argspec_function = inspect.getargspec
         except NameError:
             str_type = str
+            argspec_function = inspect.getfullargspec
         if isinstance(obj, str_type):
             obj = eval(obj, globals())
         doc = inspect.getdoc(obj)
@@ -4285,9 +4287,7 @@ See `python-check-command' for the default."
                 target = obj
                 objtype = 'def'
             if target:
-                args = inspect.formatargspec(
-                    *inspect.getargspec(target)
-                )
+                args = inspect.formatargspec(*argspec_function(target))
                 name = obj.__name__
                 doc = '{objtype} {name}{args}'.format(
                     objtype=objtype, name=name, args=args