* bug#28499: 27.0.50; Improve python.el fallback shell completion python3 compatibility
@ 2017-09-18 15:23 Jörg Behrmann
2017-09-23 0:20 ` Noam Postavsky
0 siblings, 1 reply; 5+ messages in thread
From: Jörg Behrmann @ 2017-09-18 15:23 UTC (permalink / raw)
To: 28499
[-- Attachment #1: Type: text/plain, Size: 3889 bytes --]
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))
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Improve-python3-compatibility-of-fallback-completion.patch --]
[-- Type: text/x-diff, Size: 1551 bytes --]
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
--
2.14.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#28499: 27.0.50; Improve python.el fallback shell completion python3 compatibility
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
2017-09-23 6:56 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Noam Postavsky @ 2017-09-23 0:20 UTC (permalink / raw)
To: Jörg Behrmann; +Cc: 28499
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#28499: 27.0.50; Improve python.el fallback shell completion python3 compatibility
2017-09-23 0:20 ` Noam Postavsky
@ 2017-09-23 6:56 ` Eli Zaretskii
2017-09-23 10:35 ` Jörg Behrmann
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2017-09-23 6:56 UTC (permalink / raw)
To: Noam Postavsky; +Cc: behrmann, 28499
> From: Noam Postavsky <npostavs@users.sourceforge.net>
> Date: Fri, 22 Sep 2017 20:20:53 -0400
> Cc: 28499@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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#28499: 27.0.50; Improve python.el fallback shell completion python3 compatibility
2017-09-23 6:56 ` Eli Zaretskii
@ 2017-09-23 10:35 ` Jörg Behrmann
2017-09-25 23:46 ` Noam Postavsky
0 siblings, 1 reply; 5+ messages in thread
From: Jörg Behrmann @ 2017-09-23 10:35 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Noam Postavsky, 28499
[-- Attachment #1: Type: text/plain, Size: 782 bytes --]
I have not, but I am happy to and I have just written a mail to assign@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@users.sourceforge.net>
> > Date: Fri, 22 Sep 2017 20:20:53 -0400
> > Cc: 28499@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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#28499: 27.0.50; Improve python.el fallback shell completion python3 compatibility
2017-09-23 10:35 ` Jörg Behrmann
@ 2017-09-25 23:46 ` Noam Postavsky
0 siblings, 0 replies; 5+ messages in thread
From: Noam Postavsky @ 2017-09-25 23:46 UTC (permalink / raw)
To: Jörg Behrmann; +Cc: 28499
tags 28499 fixed
close 28499 26.1
quit
Jörg Behrmann <behrmann@physik.fu-berlin.de> writes:
> I have not, but I am happy to and I have just written a mail to assign@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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-09-25 23:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2017-09-23 6:56 ` Eli Zaretskii
2017-09-23 10:35 ` Jörg Behrmann
2017-09-25 23:46 ` Noam Postavsky
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).