summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xLib/pdb.py2
-rw-r--r--Lib/test/test_pdb.py13
-rw-r--r--Misc/NEWS.d/next/Library/2020-09-01-10-12-13.bpo-26053.hXikw_.rst1
3 files changed, 15 insertions, 1 deletions
diff --git a/Lib/pdb.py b/Lib/pdb.py
index 7a5192c..98dc975 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 6c4eaf3..0da449e 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -1443,6 +1443,19 @@ def bœr():
'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 0000000..e8720ac
--- /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.