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

From: Fabián Ezequiel Gallina <[email-masked]>
Date: Mon, 08 Oct 2012 11:07:58 -0300

On 10/08/2012 04:24 AM, Jan Djärv wrote:
> (format " ?\n\\(?:%s\\|%s\\|%s\\)$"
Unfortunately it seems the patch I copied here lost the carriage return 
because of my email client or something, attaching the file instead. 
Please try this one and let me know.

Thanks!,
Fabián

=== modified file 'lisp/progmodes/python.el'
--- lisp/progmodes/python.el	2012-10-07 19:37:37 +0000
+++ lisp/progmodes/python.el	2012-10-07 19:47:52 +0000
@@ -1887,7 +1887,9 @@
    python-shell-output-filter-buffer
    (concat python-shell-output-filter-buffer string))
   (when (string-match
-         (format "\n\\(?:%s\\|%s\\|%s\\)$"
+         ;; It seems on OSX an extra carriage return might be attached
+         ;; to the end of output.
+         (format "
?\n\\(?:%s\\|%s\\|%s\\)$"
                  python-shell-prompt-regexp
                  python-shell-prompt-block-regexp
                  python-shell-prompt-pdb-regexp)