Subject: 25.0.92; Python eldoc freeze
From: Jules Tamagnan <[email-masked]>
To: [email-masked]
Date: Tue, 24 May 2016 11:34:21 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

This is an issue in relation to python and the interpetter shell. If
the python shell is running something and it is not done then when the
user goes back the the document that was being editted emacs will
freeze. If the user hits C-g then a keyboard interupt is sent to the
interpeter and the action that was being run is canceled. If the user
has the misfortune of using the mouse to click into another window then
emacs will not be able to be recovered (haven't tested that last part
entirely but the easiest way is to get back to working is to 'sudo
killall emacs')

The issue seems to be with eldoc mode. If eldoc mode (or
global-eldoc-mode) is on then python.el tries to send something to the
interepter to get the definition of the symbol at the point and then
since something is running in the interpetter emacs will hang while
waiting for the interpetter to repond. This issue is most obvious in
emacs 25 because global-eldoc-mode is on by default. This causes loss of
data.

This bug is easily reproducable from emacs -Q.
 - run emacs -Q
 - Open a file /tmp/test.py (or any other python file)
 - C-c C-p to start the interpetter (it does not matter if the interpetter
   is dedicated or not)
 - in the interpetter write an expression that will not terminate
   e.g. while True: 2+2
   e.g. (anything that plots in matplotlib)
 - go back to /tmp/test.py and type anything.
 - you will now be frozen
 - type C-g to send a keyboard interupt to the interpetter

repeating these steps without global-eldoc-mode does not cause any
issues

The most obvious fix that I have found and use is to set
global-eldoc-mode to -1 on init.

In GNU Emacs 25.0.92.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2016-04-07 built on bandersnatch
Repository revision: 6287381da495ac5cc2a2a4acb7f49825677a44c8
System Description:	Debian GNU/Linux testing (stretch)

Configured using:
 'configure --with-x-toolkit=gtk3 --with-xwidgets CC=gcc'

Configured features:
XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS NOTIFY LIBXML2 FREETYPE
LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XWIDGETS

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Python

Minor modes in effect:
  shell-dirtrack-mode: t
  gpm-mouse-mode: t
  tooltip-mode: t
  global-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
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Shell native completion is disabled, using fallback
p is undefined
y is undefined
t is undefined
Type "q" in help window to restore its previous buffer, C-M-v to scroll help.
user-error: No cross-reference here
Quit
eldoc error: (wrong-type-argument arrayp nil)
Quit
Making completion list... [4 times]

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message dired rfc822 mml mml-sec epg
epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils
thingatpt warnings compile tramp-cache python tramp-sh tramp
tramp-compat auth-source cl-seq eieio eieio-core cl-macs gnus-util
mm-util help-fns mail-prsvr password-cache tramp-loaddefs trampver
ucs-normalize shell pcomplete format-spec advice json map seq byte-opt
gv bytecomp byte-compile cconv cl-extra help-mode easymenu comint ring
cl-loaddefs pcase cl-lib ansi-color t-mouse time-date mule-util tooltip
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core 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 charscript case-table epa-hook jka-cmpr-hook help
simple abbrev 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 dynamic-setting system-font-setting font-render-setting
xwidget-internal move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
conses 16 237883 7352)
 (symbols 48 23012 0)
 (miscs 40 116 165)
 (strings 32 25679 7181)
 (string-bytes 1 1156766)
 (vectors 16 35555)
 (vector-slots 8 664891 2342)
 (floats 8 238 254)
 (intervals 56 1567 1139)
 (buffers 976 19)
 (heap 1024 23963 1702))