Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-42819: disable Readline bracketed paste #24108

Merged

Conversation

dtrodrigues
Copy link
Contributor

@dtrodrigues dtrodrigues commented Jan 5, 2021

This prevents bracketed paste from being enabled in the interactive interpreter so that paste works as expected.

https://bugs.python.org/issue42819

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@dtrodrigues

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@dtrodrigues dtrodrigues force-pushed the bpo-42819-readline-bracketed-paste branch from dea83c3 to 838a248 Compare January 6, 2021 01:36
@dtrodrigues
Copy link
Contributor Author

I rebased and force-pushed now that #24110 has been merged to fix the broken docs so that CI will pass on this PR.

@github-actions
Copy link

github-actions bot commented Feb 6, 2021

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Feb 6, 2021
@dtrodrigues
Copy link
Contributor Author

(in response to stale label) This issue still exists in Python so the PR is relevant.

@github-actions github-actions bot removed the stale Stale PR or inactive for long period of time. label Feb 7, 2021
@hroncok
Copy link
Contributor

hroncok commented Feb 13, 2021

I'll test this.

In the meantime, could you please explain why is the addition needed at two different places? Thanks.

(Note that I am not familiar with readline or the way Python uses it, I'm just the Fedora Python maintainer who saw your email on the python-dev list and realized that this also affects Fedora because we have updated as well and I've already been hit by that.)

@hroncok
Copy link
Contributor

hroncok commented Feb 13, 2021

I've applied this patch to Python 3.9.1 in Fedora Rawhide. This fixes the problem.

Before:

Python 3.9.1 (default, Jan 27 2021, 00:00:00) 
[GCC 11.0.0 20210123 (Red Hat 11.0.0-0)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 1+2
3+4
5+6
  File "<stdin>", line 1
    1+2
3+4
5+6

       ^
SyntaxError: multiple statements found while compiling a single statement

After:

Python 3.9.1 (default, Jan 27 2021, 00:00:00) 
[GCC 11.0.0 20210210 (Red Hat 11.0.0-0)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 1+2
3
>>> 3+4
7
>>> 5+6
11
>>> 

@dtrodrigues
Copy link
Contributor Author

The setting needs to be disabled after each call to rl_read_init_file in case a user manually has enabled bracketed paste within their inputrc file.

One is for when read_init_file is called from Python and the other is part of the module initialization.

Copy link
Contributor

@hroncok hroncok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changelog entry could explain why is this needed a bit. Otherwise looks good to me, it fixes the problem. Thanks!

Modules/readline.c Outdated Show resolved Hide resolved
Modules/readline.c Outdated Show resolved Hide resolved
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor formatting remarks, apart of that it LGTM

Modules/readline.c Outdated Show resolved Hide resolved
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. @hroncok: do you want to review the updated PR?

@hroncok
Copy link
Contributor

hroncok commented Feb 15, 2021

Nope, I'm good. Thanks

@hroncok
Copy link
Contributor

hroncok commented Feb 15, 2021

Label it with the backport labels for miss Islington maybe?

@vstinner vstinner merged commit 755f3c1 into python:master Feb 15, 2021
@vstinner vstinner added needs backport to 3.8 only security fixes needs backport to 3.9 only security fixes labels Feb 15, 2021
@miss-islington
Copy link
Contributor

Thanks @dtrodrigues for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Thanks @dtrodrigues for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-24545 is a backport of this pull request to the 3.9 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Feb 15, 2021
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 15, 2021
(cherry picked from commit 755f3c1)

Co-authored-by: Dustin Rodrigues <dust.rod@gmail.com>
@bedevere-bot
Copy link

GH-24546 is a backport of this pull request to the 3.8 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.8 only security fixes label Feb 15, 2021
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 15, 2021
(cherry picked from commit 755f3c1)

Co-authored-by: Dustin Rodrigues <dust.rod@gmail.com>
@vstinner
Copy link
Member

Thanks @dtrodrigues! I merged your PR and I'm backporting it to 3.8 and 3.9 branches.

miss-islington added a commit that referenced this pull request Feb 15, 2021
(cherry picked from commit 755f3c1)

Co-authored-by: Dustin Rodrigues <dust.rod@gmail.com>
vstinner pushed a commit that referenced this pull request Feb 16, 2021
(cherry picked from commit 755f3c1)

Co-authored-by: Dustin Rodrigues <dust.rod@gmail.com>

Co-authored-by: Dustin Rodrigues <dust.rod@gmail.com>
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants