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

gh-125666: Avoid PyREPL exiting when a null byte is in input #125732

Merged
merged 5 commits into from
Oct 27, 2024

Conversation

devdanzin
Copy link
Contributor

@devdanzin devdanzin commented Oct 19, 2024

This PR adds a guard against SyntaxError.lineno being None in code.InteractiveInterpreter._showtraceback, which should avoid PyREPL exiting the interpreter when a null byte is present in the input.

Not sure both new tests are necessary, happy to remove one or the other if it's better.

Lib/code.py Show resolved Hide resolved
Copy link

@fiona02 fiona02 left a comment

Choose a reason for hiding this comment

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

Combining the with statements: I merged the two with statements into a single line for conciseness, which is valid Python syntax.

@devdanzin
Copy link
Contributor Author

Thank you very much! If you can, propose it as a code change and I'll accept it, so your contribution gets recorded in a commit.

@ZeroIntensity ZeroIntensity added the topic-repl Related to the interactive shell label Oct 24, 2024
@ZeroIntensity
Copy link
Member

Thank you very much! If you can, propose it as a code change and I'll accept it, so your contribution gets recorded in a commit.

That person was a bot user, sorry!

Copy link
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

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

I think this looks fine.

@pablogsal pablogsal enabled auto-merge (squash) October 27, 2024 00:54
@pablogsal
Copy link
Member

Thanks for the contribution @devdanzin and thanks @ZeroIntensity for the review!

@pablogsal pablogsal merged commit 44becb8 into python:main Oct 27, 2024
35 checks passed
@miss-islington-app
Copy link

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 27, 2024
@bedevere-app
Copy link

bedevere-app bot commented Oct 27, 2024

GH-126023 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-repl Related to the interactive shell
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants