Skip to content

Commit

Permalink
bpo-42819: disable Readline bracketed paste
Browse files Browse the repository at this point in the history
  • Loading branch information
dtrodrigues committed Jan 6, 2021
1 parent 203b249 commit 838a248
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -1459,6 +1459,7 @@ Mark Roddy
Kevin Rodgers
Sean Rodman
Giampaolo Rodola
Dustin Rodrigues
Mauro S. M. Rodrigues
Elson Rodriguez
Adi Roiban
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Prevents bracketed paste from being enabled in the interactive interpreter,
even if it's set in the inputrc or is enabled by default (eg GNU Readline
8.1). Patch by Dustin Rodrigues.
7 changes: 7 additions & 0 deletions Modules/readline.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ readline_read_init_file_impl(PyObject *module, PyObject *filename_obj)
errno = rl_read_init_file(NULL);
if (errno)
return PyErr_SetFromErrno(PyExc_OSError);
if (!using_libedit_emulation) {
rl_variable_bind ("enable-bracketed-paste", "off");
}
Py_RETURN_NONE;
}

Expand Down Expand Up @@ -1241,6 +1244,10 @@ setup_readline(readlinestate *mod_state)
else
rl_initialize();

if (!using_libedit_emulation) {
rl_variable_bind ("enable-bracketed-paste", "off");
}

RESTORE_LOCALE(saved_locale)
return 0;
}
Expand Down

0 comments on commit 838a248

Please sign in to comment.