This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients bkabrda, dmalcolm, pitrou, skrah, vajrasky, vstinner
Date 2014-06-12.09:21:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1402564911.75.0.751500819555.issue19884@psf.upfronthosting.co.za>
In-reply-to
Content
Attached readline_disable_meta_key.patch: Implement the workaround suggested in (*), but only use the workaround if stdout is not a TTY (ex: output redirected), to limit the risk of regression.

(*) http://lists.gnu.org/archive/html/bug-readline/2011-04/msg00009.html

Extract of the patch:

+    if (!isatty(STDOUT_FILENO)) {
+        /* Issue #19884: Don't try to enable any meta modifier key the terminal
+           claims to support when it is called. On many terminals (ex:
+           xterm-256color), the meta key is used to send eight-bit characters
+           (ANSI sequence "\033[1034h"). */
+        rl_variable_bind ("enable-meta-key", "off");
+    }

This issue becomes very annoying on my Fedora 20. The output of any Mercurial command now starts with "\033.[?1034h" (Mercurial uses Python 2.7). Example:

haypo@smithers$ hg root|hexdump -C
00000000  1b 5b 3f 31 30 33 34 68  2f 68 6f 6d 65 2f 68 61  |.[?1034h/home/ha|
00000010  79 70 6f 2f 70 72 6f 67  2f 70 79 74 68 6f 6e 2f  |ypo/prog/python/|
00000020  64 65 66 61 75 6c 74 0a                           |default.|
00000028

Fedora 18 changed the default TERM environment variable to "xterm-256color":
http://fedoraproject.org/wiki/Features/256_Color_Terminals

Workaround in your application (to run on unpatched Python): set the TERM environment variable to "dummy", or unset this variable.
History
Date User Action Args
2014-06-12 09:21:51vstinnersetrecipients: + vstinner, pitrou, skrah, dmalcolm, bkabrda, vajrasky
2014-06-12 09:21:51vstinnersetmessageid: <1402564911.75.0.751500819555.issue19884@psf.upfronthosting.co.za>
2014-06-12 09:21:51vstinnerlinkissue19884 messages
2014-06-12 09:21:51vstinnercreate