all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@users.sourceforge.net>
To: "Jörg Behrmann" <behrmann@physik.fu-berlin.de>
Cc: 28499@debbugs.gnu.org
Subject: bug#28499: 27.0.50; Improve python.el fallback shell completion python3 compatibility
Date: Fri, 22 Sep 2017 20:20:53 -0400	[thread overview]
Message-ID: <87efqynu3e.fsf@users.sourceforge.net> (raw)
In-Reply-To: <8760cguj2b.fsf@boltzmann.i-did-not-set--mail-host-address--so-tickle-me> ("Jörg Behrmann"'s message of "Mon, 18 Sep 2017 17:23:40 +0200")

tags 28499 + patch
quit

Jörg Behrmann <behrmann@physik.fu-berlin.de> writes:

> When using IPython as the python-shell-interpreter using
>
> (setq python-shell-interpreter "ipython"
>       python-shell-interpreter-args "-i --simple-prompt")
>
> the fallback shell completion is used. When this IPython is using the
> python3-interpreter upon resting point on a function name some
> information is shown using eldoc, but also 
>
> /usr/sbin/ipython:21: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec()
>
> This can be easily fixed by customizing python-eldoc-setup-code to not
> only account for the differing str_type between python2 and python3, but
> to also either set inspect.getargspec or inspect.getfullargspec as
> inspection function.

Thank!  Have you assigned copyright to Emacs?  (The patch is small
enough to install regardless, I only ask to know whether it should be
marked as copyright exempt or not.)

>>From 5f7f6d47504b53e80e6bd948aa46d77612ff8504 Mon Sep 17 00:00:00 2001
> From: Joerg Behrmann <behrmann@physik.fu-berlin.de>
> Date: Mon, 18 Sep 2017 16:59:49 +0200
> Subject: [PATCH] Improve python3-compatibility of fallback completion
>
> * lisp/progmodes/python.el (python-eldoc-setup-code):
>   Use inspect.getfullargspec instead of inspect.getargspec to avoid
>   a deprecation warning on every usage of eldoc in python-mode
> ---
>  lisp/progmodes/python.el | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
> index f3513ced4b..365191c56b 100644
> --- a/lisp/progmodes/python.el
> +++ b/lisp/progmodes/python.el
> @@ -4271,8 +4271,10 @@ python-eldoc-setup-code
>          import inspect
>          try:
>              str_type = basestring
> +            argspec_function = inspect.getargspec
>          except NameError:
>              str_type = str
> +            argspec_function = inspect.getfullargspec
>          if isinstance(obj, str_type):
>              obj = eval(obj, globals())
>          doc = inspect.getdoc(obj)
> @@ -4285,9 +4287,7 @@ python-eldoc-setup-code
>                  target = obj
>                  objtype = 'def'
>              if target:
> -                args = inspect.formatargspec(
> -                    *inspect.getargspec(target)
> -                )
> +                args = inspect.formatargspec(*argspec_function(target))
>                  name = obj.__name__
>                  doc = '{objtype} {name}{args}'.format(
>                      objtype=objtype, name=name, args=args





  reply	other threads:[~2017-09-23  0:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-18 15:23 bug#28499: 27.0.50; Improve python.el fallback shell completion python3 compatibility Jörg Behrmann
2017-09-23  0:20 ` Noam Postavsky [this message]
2017-09-23  6:56   ` Eli Zaretskii
2017-09-23 10:35     ` Jörg Behrmann
2017-09-25 23:46       ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87efqynu3e.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=28499@debbugs.gnu.org \
    --cc=behrmann@physik.fu-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.