Skip to content

Commit 838a248

Browse files
committed
bpo-42819: disable Readline bracketed paste
1 parent 203b249 commit 838a248

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,6 +1459,7 @@ Mark Roddy
14591459
Kevin Rodgers
14601460
Sean Rodman
14611461
Giampaolo Rodola
1462+
Dustin Rodrigues
14621463
Mauro S. M. Rodrigues
14631464
Elson Rodriguez
14641465
Adi Roiban
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Prevents bracketed paste from being enabled in the interactive interpreter,
2+
even if it's set in the inputrc or is enabled by default (eg GNU Readline
3+
8.1). Patch by Dustin Rodrigues.

Modules/readline.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ readline_read_init_file_impl(PyObject *module, PyObject *filename_obj)
212212
errno = rl_read_init_file(NULL);
213213
if (errno)
214214
return PyErr_SetFromErrno(PyExc_OSError);
215+
if (!using_libedit_emulation) {
216+
rl_variable_bind ("enable-bracketed-paste", "off");
217+
}
215218
Py_RETURN_NONE;
216219
}
217220

@@ -1241,6 +1244,10 @@ setup_readline(readlinestate *mod_state)
12411244
else
12421245
rl_initialize();
12431246

1247+
if (!using_libedit_emulation) {
1248+
rl_variable_bind ("enable-bracketed-paste", "off");
1249+
}
1250+
12441251
RESTORE_LOCALE(saved_locale)
12451252
return 0;
12461253
}

0 commit comments

Comments
 (0)