From: Fabián Ezequiel Gallina Date: Thu, 17 May 2012 03:02:58 +0000 (-0300) Subject: Eldoc integration is now compatible with python 3 X-Git-Tag: emacs-24.2.90~1199^2~614 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9e6629387daaee10adb18baa892b4af58d2c5a33;p=emacs.git Eldoc integration is now compatible with python 3 --- diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index af441460562..739b137d566 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1413,14 +1413,19 @@ Optional argument JUSTIFY defines if the paragraph should be justified." "def __PYDOC_get_help(obj): try: import pydoc - obj = eval(obj, globals()) - return pydoc.getdoc(obj) + if hasattr(obj, 'startswith'): + obj = eval(obj, globals()) + doc = pydoc.getdoc(obj) except: - return ''" + doc = '' + try: + exec('print doc') + except SyntaxError: + print(doc)" "Python code to setup documentation retrieval.") (defvar python-eldoc-string-code - "print __PYDOC_get_help('''%s''')\n" + "__PYDOC_get_help('''%s''')\n" "Python code used to get a string with the documentation of an object.") (defun python-eldoc-setup ()