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-129900: Fix SystemExit return codes when the REPL is started from the command line #129901

Merged
merged 6 commits into from
Mar 25, 2025

Conversation

ZeroIntensity
Copy link
Member

@ZeroIntensity ZeroIntensity commented Feb 9, 2025

@ZeroIntensity ZeroIntensity added the topic-repl Related to the interactive shell label Feb 9, 2025
@ZeroIntensity ZeroIntensity added the needs backport to 3.13 bugs and security fixes label Feb 9, 2025
chrisbra added a commit to vim/vim that referenced this pull request Feb 9, 2025
…ndows

Problem:  tests: fix expected return code for python 3.13 on Windows
Solution: Check for return code 1 or 123 on Windows

There is a regression with python 3.13 on Windows, that it no longer
prints the requested error code, but instead exits with return code 1,
which  breaks the test-suite.

So let's check for either exit code 1 or 123 in tests
Test_terminal_duplicate_eof_arg() and Test_terminal_eof_arg()

This will probably be fixed on the Python side, see the pull request
python/cpython#129901 but in the meantime, let's allow both error codes.

related: #16599
related: python/cpython#129900

Signed-off-by: Christian Brabandt <cb@256bit.org>
@ZeroIntensity ZeroIntensity requested a review from vstinner March 25, 2025 13:12
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

Modules/main.c Outdated
@@ -563,7 +563,7 @@ pymain_run_stdin(PyConfig *config)
return (run != 0);
}
int run = pymain_run_module(L"_pyrepl", 0);
return (run != 0);
return run;
Copy link
Member

Choose a reason for hiding this comment

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

You can just write return pymain_run_module(L"_pyrepl", 0);.

@vstinner vstinner enabled auto-merge (squash) March 25, 2025 13:39
@ZeroIntensity
Copy link
Member Author

The CIFuzz job is acting up, I've rebased to see if that fixes it.

@vstinner vstinner merged commit 90b82f2 into python:main Mar 25, 2025
42 checks passed
@miss-islington-app
Copy link

Thanks @ZeroIntensity for the PR, and @vstinner 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 Mar 25, 2025
…ed from the command line (pythonGH-129901)

(cherry picked from commit 90b82f2)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Mar 25, 2025

GH-131734 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 Mar 25, 2025
@ZeroIntensity ZeroIntensity deleted the fix-repl-exit branch March 25, 2025 19:50
@vstinner
Copy link
Member

Merged, thanks for the fix. The backport will be merged soon.

vstinner pushed a commit that referenced this pull request Mar 25, 2025
…ted from the command line (GH-129901) (#131734)

gh-129900: Fix `SystemExit` return codes when the REPL is started from the command line (GH-129901)
(cherry picked from commit 90b82f2)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
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.

None yet

2 participants