[Python-checkins] [3.9] bpo-26053: Fix args echoed by pdb run command (GH-25149)
miss-islington
webhook-mailer at python.org
Fri Apr 2 07:33:38 EDT 2021
https://github.com/python/cpython/commit/2049bb2517c08b0d9eaaa4dd624afa5d60e8b5a8
commit: 2049bb2517c08b0d9eaaa4dd624afa5d60e8b5a8
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2021-04-02T04:33:31-07:00
summary:
[3.9] bpo-26053: Fix args echoed by pdb run command (GH-25149)
* bpo-26053: Fix args echoed by pdb run command (GH-22033)
(cherry picked from commit 652bfdee9495dca241d48278742fe035b7a82bdb)
* bpo-26053: Fix test_pdb.test_issue26053() (GH-25139)
(cherry picked from commit bd4ab8e73906a4f12d5353f567228b7c7497baf7)
(cherry picked from commit 7ad56e254519047aeb9c669b9ea2f2bf0acfd401)
Co-authored-by: Irit Katriel <iritkatriel at yahoo.com>
files:
A Misc/NEWS.d/next/Library/2020-09-01-10-12-13.bpo-26053.hXikw_.rst
M Lib/pdb.py
M Lib/test/test_pdb.py
diff --git a/Lib/pdb.py b/Lib/pdb.py
index 7a5192cbadc3a..98dc975eafafd 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -1708,7 +1708,7 @@ def main():
print("The program finished and will be restarted")
except Restart:
print("Restarting", mainpyfile, "with arguments:")
- print("\t" + " ".join(args))
+ print("\t" + " ".join(sys.argv[1:]))
except SystemExit:
# In most cases SystemExit does not warrant a post-mortem session.
print("The program exited via sys.exit(). Exit status:", end=' ')
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index f77c355077411..ac731fefdd24b 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -1440,6 +1440,19 @@ def test_issue16180(self):
'Fail to handle a syntax error in the debuggee.'
.format(expected, stdout))
+ def test_issue26053(self):
+ # run command of pdb prompt echoes the correct args
+ script = "print('hello')"
+ commands = """
+ continue
+ run a b c
+ run d e f
+ quit
+ """
+ stdout, stderr = self.run_pdb_script(script, commands)
+ res = '\n'.join([x.strip() for x in stdout.splitlines()])
+ self.assertRegex(res, "Restarting .* with arguments:\na b c")
+ self.assertRegex(res, "Restarting .* with arguments:\nd e f")
def test_readrc_kwarg(self):
script = textwrap.dedent("""
diff --git a/Misc/NEWS.d/next/Library/2020-09-01-10-12-13.bpo-26053.hXikw_.rst b/Misc/NEWS.d/next/Library/2020-09-01-10-12-13.bpo-26053.hXikw_.rst
new file mode 100644
index 0000000000000..e8720ac82ffb1
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-09-01-10-12-13.bpo-26053.hXikw_.rst
@@ -0,0 +1 @@
+Fixed bug where the :mod:`pdb` interactive run command echoed the args from the shell command line, even if those have been overridden at the pdb prompt.
More information about the Python-checkins
mailing list