Skip to content

Commit aac9b71

Browse files
committed
Issue python#19884: Merge Readline updates from 3.5
2 parents ef91bb2 + c427b8d commit aac9b71

3 files changed

Lines changed: 18 additions & 13 deletions

File tree

‎Lib/test/test_readline.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def test_nonascii_history(self):
111111

112112
class TestReadline(unittest.TestCase):
113113

114-
@unittest.skipIf(readline._READLINE_VERSION < 0x0600 and not is_editline,
114+
@unittest.skipIf(readline._READLINE_VERSION < 0x0601 and not is_editline,
115115
"not supported in this library version")
116116
def test_init(self):
117117
# Issue #19884: Ensure that the ANSI sequence "\033[1034h" is not

‎Misc/NEWS‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ Core and Builtins
4646
Library
4747
-------
4848

49+
- Issue #19884: Avoid spurious output on OS X with Gnu Readline.
50+
4951
- Issue #10513: Fix a regression in Connection.commit(). Statements should
5052
not be reset after a commit.
5153

‎Modules/readline.c‎

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,19 +1146,22 @@ setup_readline(readlinestate *mod_state)
11461146
mod_state->begidx = PyLong_FromLong(0L);
11471147
mod_state->endidx = PyLong_FromLong(0L);
11481148

1149-
#ifndef __APPLE__
1150-
if (!isatty(STDOUT_FILENO)) {
1151-
/* Issue #19884: stdout is not a terminal. Disable meta modifier
1152-
keys to not write the ANSI sequence "\033[1034h" into stdout. On
1153-
terminals supporting 8 bit characters like TERM=xterm-256color
1154-
(which is now the default Fedora since Fedora 18), the meta key is
1155-
used to enable support of 8 bit characters (ANSI sequence
1156-
"\033[1034h").
1157-
1158-
With libedit, this call makes readline() crash. */
1159-
rl_variable_bind ("enable-meta-key", "off");
1160-
}
1149+
#ifdef __APPLE__
1150+
if (!using_libedit_emulation)
11611151
#endif
1152+
{
1153+
if (!isatty(STDOUT_FILENO)) {
1154+
/* Issue #19884: stdout is not a terminal. Disable meta modifier
1155+
keys to not write the ANSI sequence "\033[1034h" into stdout. On
1156+
terminals supporting 8 bit characters like TERM=xterm-256color
1157+
(which is now the default Fedora since Fedora 18), the meta key is
1158+
used to enable support of 8 bit characters (ANSI sequence
1159+
"\033[1034h").
1160+
1161+
With libedit, this call makes readline() crash. */
1162+
rl_variable_bind ("enable-meta-key", "off");
1163+
}
1164+
}
11621165

11631166
/* Initialize (allows .inputrc to override)
11641167
*

0 commit comments

Comments
 (0)