GNU bug report logs - #28499
27.0.50; Improve python.el fallback shell completion python3 compatibility

Previous Next

Package: emacs;

Reported by: Jörg Behrmann <behrmann <at> physik.fu-berlin.de>

Date: Mon, 18 Sep 2017 15:33:02 UTC

Severity: normal

Tags: fixed, patch

Found in version 27.0.50

Fixed in version 26.1

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 28499 in the body.
You can then email your comments to 28499 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#28499; Package emacs. (Mon, 18 Sep 2017 15:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jörg Behrmann <behrmann <at> physik.fu-berlin.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 18 Sep 2017 15:33:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jörg Behrmann <behrmann <at> physik.fu-berlin.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50;
 Improve python.el fallback shell completion python3 compatibility
Date: Mon, 18 Sep 2017 17:23:40 +0200
[Message part 1 (text/plain, inline)]
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.

In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.21)
 of 2017-09-18 built on boltzmann
Repository revision: 61a5c30e70926f48480b03b79f4f531c8d64418e
Windowing system distributor 'The X.Org Foundation', version 11.0.11903000
System Description:	Arch Linux

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
 'configure --prefix=/home/drako/.devlocal'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11 LIBSYSTEMD LCMS2

Important settings:
  value of $LC_COLLATE: de_DE.utf8
  value of $LC_MONETARY: de_DE.utf8
  value of $LC_NUMERIC: en_US.utf8
  value of $LC_TIME: de_DE.utf8
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix

Major mode: Python

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message subr-x puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils python easymenu tramp-sh tramp
tramp-compat tramp-loaddefs trampver ucs-normalize shell pcomplete
parse-time format-spec advice auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache json map seq byte-opt gv bytecomp
byte-compile cconv comint ring cl-loaddefs cl-lib ansi-color elec-pair
time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 224182 11719)
 (symbols 48 22573 1)
 (miscs 40 52 176)
 (strings 32 36999 1441)
 (string-bytes 1 1087109)
 (vectors 16 38977)
 (vector-slots 8 758280 10386)
 (floats 8 67 517)
 (intervals 56 468 0)
 (buffers 992 12))
[0001-Improve-python3-compatibility-of-fallback-completion.patch (text/x-diff, inline)]
From 5f7f6d47504b53e80e6bd948aa46d77612ff8504 Mon Sep 17 00:00:00 2001
From: Joerg Behrmann <behrmann <at> 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
-- 
2.14.1


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28499; Package emacs. (Sat, 23 Sep 2017 00:22:01 GMT) Full text and rfc822 format available.

Message #8 received at 28499 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Jörg Behrmann <behrmann <at> physik.fu-berlin.de>
Cc: 28499 <at> debbugs.gnu.org
Subject: Re: bug#28499: 27.0.50;
 Improve python.el fallback shell completion python3 compatibility
Date: Fri, 22 Sep 2017 20:20:53 -0400
tags 28499 + patch
quit

Jörg Behrmann <behrmann <at> 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 <at> 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




Added tag(s) patch. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Sat, 23 Sep 2017 00:22:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28499; Package emacs. (Sat, 23 Sep 2017 06:57:02 GMT) Full text and rfc822 format available.

Message #13 received at 28499 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: behrmann <at> physik.fu-berlin.de, 28499 <at> debbugs.gnu.org
Subject: Re: bug#28499: 27.0.50;
 Improve python.el fallback shell completion python3 compatibility
Date: Sat, 23 Sep 2017 09:56:20 +0300
> From: Noam Postavsky <npostavs <at> users.sourceforge.net>
> Date: Fri, 22 Sep 2017 20:20:53 -0400
> Cc: 28499 <at> debbugs.gnu.org
> 
> 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.)

Jörg's name is not on file, no.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28499; Package emacs. (Sat, 23 Sep 2017 10:36:02 GMT) Full text and rfc822 format available.

Message #16 received at 28499 <at> debbugs.gnu.org (full text, mbox):

From: Jörg Behrmann <behrmann <at> physik.fu-berlin.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 28499 <at> debbugs.gnu.org, Noam Postavsky <npostavs <at> users.sourceforge.net>
Subject: Re: bug#28499: 27.0.50; Improve python.el fallback shell completion
 python3 compatibility
Date: Sat, 23 Sep 2017 12:35:24 +0200
[Message part 1 (text/plain, inline)]
I have not, but I am happy to and I have just written a mail to assign <at> gnu.org
to start the process. This is my first contribution though and it is trivially
small (i.e. smaller than 15 lines), so I think it could be merged without the
copyright assignment.

Is the patch acceptable in its current form or is there anything else I need to
do?

On Sat, Sep 23, 2017 at 09:56:20AM +0300, Eli Zaretskii wrote:
> > From: Noam Postavsky <npostavs <at> users.sourceforge.net>
> > Date: Fri, 22 Sep 2017 20:20:53 -0400
> > Cc: 28499 <at> debbugs.gnu.org
> > 
> > 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.)
> 
> Jörg's name is not on file, no.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28499; Package emacs. (Mon, 25 Sep 2017 23:47:01 GMT) Full text and rfc822 format available.

Message #19 received at 28499 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Jörg Behrmann <behrmann <at> physik.fu-berlin.de>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 28499 <at> debbugs.gnu.org
Subject: Re: bug#28499: 27.0.50;
 Improve python.el fallback shell completion python3 compatibility
Date: Mon, 25 Sep 2017 19:46:27 -0400
tags 28499 fixed
close 28499 26.1
quit

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

> I have not, but I am happy to and I have just written a mail to assign <at> gnu.org
> to start the process. This is my first contribution though and it is trivially
> small (i.e. smaller than 15 lines), so I think it could be merged without the
> copyright assignment.
>
> Is the patch acceptable in its current form or is there anything else I need to
> do?

Nope, it's all good, I've now pushed it to emacs-26.  Thanks for the patch!

[1: a2244f417a]: 2017-09-25 19:39:19 -0400
  Improve python3-compatibility of fallback completion (Bug#28499)
  http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=a2244f417a7cf577172cec927b055f0aca9ef282




Added tag(s) fixed. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Mon, 25 Sep 2017 23:47:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 26.1, send any further explanations to 28499 <at> debbugs.gnu.org and Jörg Behrmann <behrmann <at> physik.fu-berlin.de> Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Mon, 25 Sep 2017 23:47:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 24 Oct 2017 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 237 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.