diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 13 |
1 files changed, 9 insertions, 4 deletions
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." | |||
| 1413 | "def __PYDOC_get_help(obj): | 1413 | "def __PYDOC_get_help(obj): |
| 1414 | try: | 1414 | try: |
| 1415 | import pydoc | 1415 | import pydoc |
| 1416 | obj = eval(obj, globals()) | 1416 | if hasattr(obj, 'startswith'): |
| 1417 | return pydoc.getdoc(obj) | 1417 | obj = eval(obj, globals()) |
| 1418 | doc = pydoc.getdoc(obj) | ||
| 1418 | except: | 1419 | except: |
| 1419 | return ''" | 1420 | doc = '' |
| 1421 | try: | ||
| 1422 | exec('print doc') | ||
| 1423 | except SyntaxError: | ||
| 1424 | print(doc)" | ||
| 1420 | "Python code to setup documentation retrieval.") | 1425 | "Python code to setup documentation retrieval.") |
| 1421 | 1426 | ||
| 1422 | (defvar python-eldoc-string-code | 1427 | (defvar python-eldoc-string-code |
| 1423 | "print __PYDOC_get_help('''%s''')\n" | 1428 | "__PYDOC_get_help('''%s''')\n" |
| 1424 | "Python code used to get a string with the documentation of an object.") | 1429 | "Python code used to get a string with the documentation of an object.") |
| 1425 | 1430 | ||
| 1426 | (defun python-eldoc-setup () | 1431 | (defun python-eldoc-setup () |