https://github.com/python/cpython/commit/4f18916c5c28321f363e85ee7ef3ee29bbf79d8e commit: 4f18916c5c28321f363e85ee7ef3ee29bbf79d8e branch: main author: Tian Gao <gaogaotiant...@hotmail.com> committer: gaogaotiantian <gaogaotiant...@hotmail.com> date: 2025-04-26T18:43:23-04:00 summary:
gh-124703: Set return code to 1 when aborting process from pdb (#133013) files: A Misc/NEWS.d/next/Library/2025-04-26-15-43-23.gh-issue-124703.jc5auS.rst M Lib/pdb.py M Lib/test/test_pdb.py diff --git a/Lib/pdb.py b/Lib/pdb.py index 380c6a56db72e5..5ade628e2d5d23 100644 --- a/Lib/pdb.py +++ b/Lib/pdb.py @@ -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 diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index 60a41becea4ca1..741b5ab92856b7 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -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 @@ -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 diff --git a/Misc/NEWS.d/next/Library/2025-04-26-15-43-23.gh-issue-124703.jc5auS.rst b/Misc/NEWS.d/next/Library/2025-04-26-15-43-23.gh-issue-124703.jc5auS.rst new file mode 100644 index 00000000000000..54603dda39e977 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-04-26-15-43-23.gh-issue-124703.jc5auS.rst @@ -0,0 +1 @@ +Set return code to ``1`` when aborting process from :mod:`pdb`. _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com