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
This commit is contained in:
parent
79162cb0db
commit
a2244f417a
1 changed files with 3 additions and 3 deletions
|
@ -4271,8 +4271,10 @@ See `python-check-command' for the default."
|
||||||
import inspect
|
import inspect
|
||||||
try:
|
try:
|
||||||
str_type = basestring
|
str_type = basestring
|
||||||
|
argspec_function = inspect.getargspec
|
||||||
except NameError:
|
except NameError:
|
||||||
str_type = str
|
str_type = str
|
||||||
|
argspec_function = inspect.getfullargspec
|
||||||
if isinstance(obj, str_type):
|
if isinstance(obj, str_type):
|
||||||
obj = eval(obj, globals())
|
obj = eval(obj, globals())
|
||||||
doc = inspect.getdoc(obj)
|
doc = inspect.getdoc(obj)
|
||||||
|
@ -4285,9 +4287,7 @@ See `python-check-command' for the default."
|
||||||
target = obj
|
target = obj
|
||||||
objtype = 'def'
|
objtype = 'def'
|
||||||
if target:
|
if target:
|
||||||
args = inspect.formatargspec(
|
args = inspect.formatargspec(*argspec_function(target))
|
||||||
*inspect.getargspec(target)
|
|
||||||
)
|
|
||||||
name = obj.__name__
|
name = obj.__name__
|
||||||
doc = '{objtype} {name}{args}'.format(
|
doc = '{objtype} {name}{args}'.format(
|
||||||
objtype=objtype, name=name, args=args
|
objtype=objtype, name=name, args=args
|
||||||
|
|
Loading…
Add table
Reference in a new issue