]> git.eshelyaron.com Git - emacs.git/commitdiff
Eldoc integration is now compatible with python 3
authorFabián Ezequiel Gallina <fgallina@cuca>
Thu, 17 May 2012 03:02:58 +0000 (00:02 -0300)
committerFabián Ezequiel Gallina <fgallina@gnu.org>
Thu, 17 May 2012 03:02:58 +0000 (00:02 -0300)
lisp/progmodes/python.el

index af441460562683c2ddaab6e13ba6578be1f8fb5f..739b137d566bc6ac8e29850ae66f25ffc74c75e1 100644 (file)
@@ -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 ()