diff options
| author | Fabián Ezequiel Gallina | 2014-11-15 15:50:30 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2014-11-15 15:50:30 -0300 |
| commit | 9ae5396b8f152a4ab32f1d56239f3f5e3967da0b (patch) | |
| tree | 3d3b76b0302290583152b0e7a7b2608689596f35 /lisp/progmodes/python.el | |
| parent | 5fa7b7181a2c474c6e0b9480d92e34305bca31ed (diff) | |
| download | emacs-9ae5396b8f152a4ab32f1d56239f3f5e3967da0b.tar.gz emacs-9ae5396b8f152a4ab32f1d56239f3f5e3967da0b.zip | |
Eldoc setup code enhancements
Fixes: debbugs:18962
* lisp/progmodes/python.el (python-eldoc-setup-code): Enhance string
type checks, simplify printing.
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 11 |
1 files changed, 6 insertions, 5 deletions
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." | |||
| 3546 | "def __PYDOC_get_help(obj): | 3546 | "def __PYDOC_get_help(obj): |
| 3547 | try: | 3547 | try: |
| 3548 | import inspect | 3548 | import inspect |
| 3549 | if hasattr(obj, 'startswith'): | 3549 | try: |
| 3550 | str_type = basestring | ||
| 3551 | except NameError: | ||
| 3552 | str_type = str | ||
| 3553 | if isinstance(obj, str_type): | ||
| 3550 | obj = eval(obj, globals()) | 3554 | obj = eval(obj, globals()) |
| 3551 | doc = inspect.getdoc(obj) | 3555 | doc = inspect.getdoc(obj) |
| 3552 | if not doc and callable(obj): | 3556 | if not doc and callable(obj): |
| @@ -3569,10 +3573,7 @@ See `python-check-command' for the default." | |||
| 3569 | doc = doc.splitlines()[0] | 3573 | doc = doc.splitlines()[0] |
| 3570 | except: | 3574 | except: |
| 3571 | doc = '' | 3575 | doc = '' |
| 3572 | try: | 3576 | print (doc)" |
| 3573 | exec('print doc') | ||
| 3574 | except SyntaxError: | ||
| 3575 | print(doc)" | ||
| 3576 | "Python code to setup documentation retrieval." | 3577 | "Python code to setup documentation retrieval." |
| 3577 | :type 'string | 3578 | :type 'string |
| 3578 | :group 'python) | 3579 | :group 'python) |