8000 gh-133548: fix handling of empty and 1-item tuples for `sys.exit` by picnixz · Pull Request #135789 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-133548: fix handling of empty and 1-item tuples for sys.exit #135789

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
reduce a bit the diff
  • Loading branch information
picnixz committed Jun 23, 2025
commit 6b65314aea2f4346b9c1075eadd14806ac9b2b0c
14 changes: 7 additions & 7 deletions Lib/test/test_sys.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,19 +297,19 @@ def check_exit_message(code, expected, **env_vars):
# into stderr
check_exit_message(
sys_exit_impl("'message'", 'sys.stderr.write("unflushed,")'),
b"unflushed,message"
)
b"unflushed,message")

# test that the exit message is written with backslashreplace error
# handler to stderr
check_exit_message(sys_exit_impl(r"'surrogates:\uDCFF'"),
b"surrogates:\\udcff")
check_exit_message(
sys_exit_impl(r"'surrogates:\uDCFF'"),
b"surrogates:\\udcff")

# test that the unicode message is encoded to the stderr encoding
# instead of the default encoding (utf8)
check_exit_message(sys_exit_impl(r"'h\xe9'"), b"h\xe9",
PYTHONIOENCODING='latin-1')

check_exit_message(
sys_exit_impl(r"'h\xe9'"),
b"h\xe9", PYTHONIOENCODING='latin-1')

@support.requires_subprocess()
def test_exit_codes_under_repl(self):
Expand Down
Loading
0