Subject: bug#12409: 24.2.50; OS X Python completion leaks junk to inferior-python-mode buffer

From: Dan Davison <[email-masked]>
Date: Mon, 10 Sep 2012 22:22:02 -0700

1. emacs -nw -q
2. M-x run-python
3. At the prompt, enter "aaaa = 4" followed by RETURN
4. At the prompt, enter "aaaaaa = 6" followed by RETURN
5. At the prompt enter "aa" followed by TAB to request a completion

After step (4) the buffer contents look like:
>>> aaaa = 4
>>> aaaaaa = 6

After step (5) it looks like:

>>> aaaa = 4
>>> aaaaaa = 6
>>> 'aaaa;aaaaaa'
>>> aaaa

Notice that the string containing possible completions was leaked to the
shell buffer.

The bug occurs both when running emacs in a terminal with `emacs -nw -q`
and when running the emacs cocoa app. Some discussion of this bug can
be found at
https://github.com/fgallina/python.el/issues/92. It seems to be OS X-specific,
related to `accept-process-output`.

Dan

In GNU Emacs 24.2.50.1 (x86_64-apple-darwin10.8.0, NS apple-appkit-1038.36)
 of 2012-09-10 on cotinga.local
Windowing system distributor `Apple', version 10.3.1038
Configured using:
 `configure '--with-ns' '--with-png=no' '--with-gif=no''

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Inferior Python

Minor modes in effect:
  compilation-shell-minor-mode: t
  tooltip-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 input:
SPC ESC O A ESC O D ESC O D ESC O D ESC O D ESC O D
ESC O D ESC O D ESC O D RET ESC O B ESC O C ESC O C
ESC O C ESC O C ESC O C ESC O C ESC O C ESC O C ESC
O C RET C-x o ESC O A ESC O B ESC O B ESC O B C-x o
ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC
O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B
ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC
O B ESC O B ESC O A ESC O A ESC O A ESC O A ESC O A
ESC O A ESC O A ESC O B ESC O A ESC x r e p o TAB r
TAB TAB RET C-g C-x b * P y TAB RET C-h v m a j o TAB
RET C-x C-f C-g C-u C-g C-x C-f DEL DEL DEL DEL DEL
DEL DEL DEL DEL DEL DEL DEL DEL DEL DEL DEL DEL DEL
DEL DEL DEL DEL DEL d a v TAB n o n TAB p y t TAB .
TAB z TAB . p y RET d e f s DEL a TAB ESC O B TAB ESC
O B TAB ESC O B a TAB ESC O B DEL ESC x c o m p l TAB
i TAB a t TAB RET a ESC x ESC O A RET C-x b RET ESC
x r e p o r TAB RET

Recent messages:
Can't guess python-indent-offset, using defaults: 4
Loading vc-git...done
...on_work/python.el/z.py locked by davison@cotin... (pid 2599): (s, q, p, ?)?
Please type q, s, or p; or ? for help
...on_work/python.el/z.py locked by davison@cotin... (pid 2599): (s, q, p, ?)?
Please type q, s, or p; or ? for help
...on_work/python.el/z.py locked by davison@cotin... (pid 2599): (s, q, p, ?)?
byte-code: End of buffer [4 times]
Making completion list...
You can run the command `completion-at-point' with C-M-i [2 times]

Load-path shadows:
None found.

Features:
(shadow sort mail-extr vc-git pp browse-url wid-edit network-stream
starttls url-http tls url-gw url-cache url-auth url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util url-parse auth-source eieio byte-opt bytecomp byte-compile
cconv gnus-util password-cache url-vars mailcap emacsbug message
format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils compile python rx comint ring
ansi-color help-mode easymenu help-fns time-date tooltip ediff-hook
vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process ns multi-tty emacs)