Commit a2244f41 authored by Joerg Behrmann's avatar Joerg Behrmann Committed by Noam Postavsky

Improve python3-compatibility of fallback completion (Bug#28499)

* 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
parent 79162cb0
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment