From 9ae5396b8f152a4ab32f1d56239f3f5e3967da0b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fabi=C3=A1n=20Ezequiel=20Gallina?= Date: Sat, 15 Nov 2014 15:50:30 -0300 Subject: [PATCH] Eldoc setup code enhancements Fixes: debbugs:18962 * lisp/progmodes/python.el (python-eldoc-setup-code): Enhance string type checks, simplify printing. --- lisp/ChangeLog | 5 +++++ lisp/progmodes/python.el | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e2e535279c0..5c7533f1073 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-11-15 Fabián Ezequiel Gallina + + * progmodes/python.el (python-eldoc-setup-code): Enhance string + type checks, simplify printing. (Bug#18962) + 2014-11-14 Ivan Andrus * progmodes/python.el (python-shell-font-lock-kill-buffer): diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 2fcbe6430f2..961aebeeecd 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -3546,7 +3546,11 @@ See `python-check-command' for the default." "def __PYDOC_get_help(obj): try: import inspect - if hasattr(obj, 'startswith'): + try: + str_type = basestring + except NameError: + str_type = str + if isinstance(obj, str_type): obj = eval(obj, globals()) doc = inspect.getdoc(obj) if not doc and callable(obj): @@ -3569,10 +3573,7 @@ See `python-check-command' for the default." doc = doc.splitlines()[0] except: doc = '' - try: - exec('print doc') - except SyntaxError: - print(doc)" + print (doc)" "Python code to setup documentation retrieval." :type 'string :group 'python) -- 2.39.5