Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cpython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sip
Cpython
Commits
755f3c15
Unverified
Commit
755f3c15
authored
Feb 15, 2021
by
Dustin Rodrigues
Committed by
GitHub
Feb 15, 2021
Browse files
Options
Downloads
Patches
Plain Diff
bpo-42819, readline: Disable bracketed paste (GH-24108)
parent
813db24f
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Misc/ACKS
+1
-0
1 addition, 0 deletions
Misc/ACKS
Misc/NEWS.d/next/Core and Builtins/2021-01-04-23-54-34.bpo-42819.4KO6wU.rst
+8
-0
8 additions, 0 deletions
...ore and Builtins/2021-01-04-23-54-34.bpo-42819.4KO6wU.rst
Modules/readline.c
+23
-0
23 additions, 0 deletions
Modules/readline.c
with
32 additions
and
0 deletions
Misc/ACKS
+
1
−
0
View file @
755f3c15
...
...
@@ -1461,6 +1461,7 @@ Mark Roddy
Kevin Rodgers
Sean Rodman
Giampaolo Rodola
Dustin Rodrigues
Mauro S. M. Rodrigues
Elson Rodriguez
Adi Roiban
...
...
This diff is collapsed.
Click to expand it.
Misc/NEWS.d/next/Core and Builtins/2021-01-04-23-54-34.bpo-42819.4KO6wU.rst
0 → 100644
+
8
−
0
View file @
755f3c15
:mod:`readline`: Explicitly disable bracketed paste in the interactive
interpreter, even if it's set in the inputrc, is enabled by default (eg GNU
Readline 8.1), or a user calls ``readline.read_init_file()``. The Python REPL
has not implemented bracketed paste support. Also, bracketed mode writes the
``"\x1b[?2004h"`` escape sequence into stdout which causes test failures in
applications that don't support it. It can still be explicitly enabled by
calling ``readline.parse_and_bind("set enable-bracketed-paste on")``. Patch by
Dustin Rodrigues.
This diff is collapsed.
Click to expand it.
Modules/readline.c
+
23
−
0
View file @
755f3c15
...
...
@@ -156,6 +156,26 @@ decode(const char *s)
}
/*
Explicitly disable bracketed paste in the interactive interpreter, even if it's
set in the inputrc, is enabled by default (eg GNU Readline 8.1), or a user calls
readline.read_init_file(). The Python REPL has not implemented bracketed
paste support. Also, bracketed mode writes the "\x1b[?2004h" escape sequence
into stdout which causes test failures in applications that don't support it.
It can still be explicitly enabled by calling readline.parse_and_bind("set
enable-bracketed-paste on"). See bpo-42819 for more details.
This should be removed if bracketed paste mode is implemented (bpo-39820).
*/
static
void
disable_bracketed_paste
(
void
)
{
if
(
!
using_libedit_emulation
)
{
rl_variable_bind
(
"enable-bracketed-paste"
,
"off"
);
}
}
/* Exported function to send one line to readline's init file parser */
/*[clinic input]
...
...
@@ -217,6 +237,7 @@ readline_read_init_file_impl(PyObject *module, PyObject *filename_obj)
errno
=
rl_read_init_file
(
NULL
);
if
(
errno
)
return
PyErr_SetFromErrno
(
PyExc_OSError
);
disable_bracketed_paste
();
Py_RETURN_NONE
;
}
...
...
@@ -1267,6 +1288,8 @@ setup_readline(readlinestate *mod_state)
else
rl_initialize
();
disable_bracketed_paste
();
RESTORE_LOCALE
(
saved_locale
)
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment