From 8d0b0cec983553d6313c06727563152a2d92b20e Mon Sep 17 00:00:00 2001 From: Tian Gao Date: Sat, 26 Apr 2025 11:39:45 -0400 Subject: [PATCH 1/3] Set return code to 1 when aborting process from pdb --- Lib/pdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 0261fd0060d0305b0d2b6f2224ef9bfe8bf86c64 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sat, 26 Apr 2025 15:43:28 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2025-04-26-15-43-23.gh-issue-124703.jc5auS.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2025-04-26-15-43-23.gh-issue-124703.jc5auS.rst 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`. From bb1558bfc4138df01bdbfa10785cb53e83861a28 Mon Sep 17 00:00:00 2001 From: Tian Gao Date: Sat, 26 Apr 2025 11:52:14 -0400 Subject: [PATCH 3/3] Fix tests --- Lib/test/test_pdb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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