Skip to content

gh-124703: Set return code to 1 when aborting process from pdb #133013

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

Merged
merged 3 commits into from
Apr 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Lib/pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1834,7 +1834,7 @@ def do_quit(self, arg):
reply = 'y'
self.message('')
if reply == 'y' or reply == '':
sys.exit(0)
sys.exit(1)
elif reply.lower() == 'n':
return

Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -4453,7 +4453,7 @@ def test_quit(self):
y
"""

stdout, stderr = self._run_script(script, commands)
stdout, stderr = self._run_script(script, commands, expected_returncode=1)
self.assertIn("2", stdout)
self.assertIn("Quit anyway", stdout)
# Closing stdin will quit the debugger anyway so we need to confirm
Expand Down Expand Up @@ -4483,7 +4483,7 @@ def test_quit_after_interact(self):
y
"""

stdout, stderr = self._run_script(script, commands)
stdout, stderr = self._run_script(script, commands, expected_returncode=1)
# Normal exit should not print anything to stderr
self.assertEqual(stderr, "")
# The quit prompt should be printed exactly once
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Set return code to ``1`` when aborting process from :mod:`pdb`.
Loading