Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-129098: avoid using content of_pyrepl/__main__.py when reporting tracebacks#130721

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
pablogsal merged 3 commits intopython:mainfrompicnixz:fix/repl/show-source-129098
Apr 20, 2025

Conversation

@picnixz
Copy link
Member

@picnixzpicnixz commentedMar 1, 2025
edited
Loading

I don't know how to test this :)

@picnixzpicnixz changed the titlegh- 129098: avoid using content of_pyrepl/__main__.py when reporting tracebacksgh-129098: avoid using content of_pyrepl/__main__.py when reporting tracebacksMar 1, 2025
@picnixz
Copy link
MemberAuthor

I'm marking the PR as ready for review to know whether this is the correct alternative.

@picnixzpicnixz marked this pull request as ready for reviewMarch 2, 2025 00:13
@skirpichev
Copy link
Contributor

I don't know how to test this :)

Maybe something like this (that for unpatched version):

diff --git a/Lib/test/test_pyrepl/test_pyrepl.py b/Lib/test/test_pyrepl/test_pyrepl.pyindex 3540d2a5a4..1d76121364 100644--- a/Lib/test/test_pyrepl/test_pyrepl.py+++ b/Lib/test/test_pyrepl/test_pyrepl.py@@ -1216,6 +1216,15 @@ def test_python_basic_repl(self):         self.assertNotIn("Exception", output)         self.assertNotIn("Traceback", output)+    @force_not_colorized+    def test_no_pyrepl_source_in_exc(self):+        env = os.environ.copy()+        commands = "eval(compile('spam', 'spam', 'eval'))\nexit()\n"+        env.pop("PYTHON_BASIC_REPL", None)+        output, exit_code = self.run_repl(commands, env=env)+        self.assertIn("Traceback", output)+        self.assertIn("# Important: don't add things to this module", output)+     @force_not_colorized     def test_bad_sys_excepthook_doesnt_crash_pyrepl(self):         env = os.environ.copy()
picnixz reacted with heart emoji

@picnixzpicnixz added the needs backport to 3.13bugs and security fixes labelMar 14, 2025
@picnixz
Copy link
MemberAuthor

@pablogsal@ambv Could you have a look at this one to see if we can use this fix?

Copy link
Member

@pablogsalpablogsal left a comment

Choose a reason for hiding this comment

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

LGTM

self.assertTrue(os.path.exists(pyrepl_main_file),pyrepl_main_file)
withopen(pyrepl_main_file)asfp:
excluded_lines=fp.readlines()
excluded_lines=list(filter(None,map(str.strip,excluded_lines)))
Copy link
Member

Choose a reason for hiding this comment

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

A bit nuclear and maybe fragile as the lines can be in other future test but I know this is thinking too far ahead. I think this is reasonable for now. Well done!

@pablogsalpablogsal merged commit492e3e6 intopython:mainApr 20, 2025
53 checks passed
@miss-islington-app
Copy link

Thanks@picnixz 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 requestApr 20, 2025
…porting tracebacks (pythonGH-130721)(cherry picked from commit492e3e6)Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@bedevere-app
Copy link

GH-132755 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelApr 20, 2025
pablogsal pushed a commit that referenced this pull requestApr 20, 2025
…eporting tracebacks (GH-130721) (#132755)gh-129098: avoid using content of `_pyrepl/__main__.py` when reporting tracebacks (GH-130721)(cherry picked from commit492e3e6)Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@picnixzpicnixz deleted the fix/repl/show-source-129098 branchApril 24, 2025 21:04
picnixz added a commit to picnixz/cpython that referenced this pull requestApr 28, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@pablogsalpablogsalpablogsal approved these changes

@lysnikolaoulysnikolaouAwaiting requested review from lysnikolaoulysnikolaou is a code owner

@ambvambvAwaiting requested review from ambvambv is a code owner

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@picnixz@skirpichev@pablogsal

[8]ページ先頭

©2009-2025 Movatter.jp