diff options
| author | R David Murray <rdmurray@bitdance.com> | 2013-10-10 21:23:26 (GMT) |
|---|---|---|
| committer | R David Murray <rdmurray@bitdance.com> | 2013-10-10 21:23:26 (GMT) |
| commit | 78d692f98e395f3fc4ec2f53343a67bb1d0e94c5 (patch) | |
| tree | aee46766ae650cf4be85704bf5082bbef53abb25 /Lib | |
| parent | 2fe9bac4dca34e86d44b7e169f3795fde4c841a1 (diff) | |
| download | cpython-78d692f98e395f3fc4ec2f53343a67bb1d0e94c5.zip cpython-78d692f98e395f3fc4ec2f53343a67bb1d0e94c5.tar.gz cpython-78d692f98e395f3fc4ec2f53343a67bb1d0e94c5.tar.bz2 | |
18764: remove the problematic 'print' alias for the PDB 'p' command.
So that it no longer shadows the print function.
Patch by Connor Osborn, doc and test changes by R. David Murray.
Diffstat (limited to 'Lib')
| -rwxr-xr-x | Lib/pdb.py | 8 | ||||
| -rw-r--r-- | Lib/test/test_pdb.py | 9 |
2 files changed, 9 insertions, 8 deletions
@@ -1159,15 +1159,13 @@ class Pdb(bdb.Bdb, cmd.Cmd): return _rstr('** raised %s **' % err) def do_p(self, arg): - """p(rint) expression + """p expression Print the value of the expression. """ try: self.message(repr(self._getval(arg))) except: pass - # make "print" an alias of "p" since print isn't a Python statement anymore - do_print = do_p def do_pp(self, arg): """pp expression @@ -1388,7 +1386,7 @@ class Pdb(bdb.Bdb, cmd.Cmd): placed in the .pdbrc file): # Print instance variables (usage "pi classInst") - alias pi for k in %1.__dict__.keys(): print "%1.",k,"=",%1.__dict__[k] + alias pi for k in %1.__dict__.keys(): print("%1.",k,"=",%1.__dict__[k]) # Print instance variables in self alias ps pi self """ @@ -1546,7 +1544,7 @@ if __doc__ is not None: 'help', 'where', 'down', 'up', 'break', 'tbreak', 'clear', 'disable', 'enable', 'ignore', 'condition', 'commands', 'step', 'next', 'until', 'jump', 'return', 'retval', 'run', 'continue', 'list', 'longlist', - 'args', 'print', 'pp', 'whatis', 'source', 'display', 'undisplay', + 'args', 'p', 'pp', 'whatis', 'source', 'display', 'undisplay', 'interact', 'alias', 'unalias', 'debug', 'quit', ] diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index 0babaa0..e17f933 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -205,7 +205,8 @@ def test_pdb_breakpoint_commands(): ... 'enable 1', ... 'clear 1', ... 'commands 2', - ... 'print 42', + ... 'p "42"', + ... 'print("42", 7*6)', # Issue 18764 (not about breakpoints) ... 'end', ... 'continue', # will stop at breakpoint 2 (line 4) ... 'clear', # clear all! @@ -252,11 +253,13 @@ def test_pdb_breakpoint_commands(): (Pdb) clear 1 Deleted breakpoint 1 at <doctest test.test_pdb.test_pdb_breakpoint_commands[0]>:3 (Pdb) commands 2 - (com) print 42 + (com) p "42" + (com) print("42", 7*6) (com) end (Pdb) continue 1 - 42 + '42' + 42 42 > <doctest test.test_pdb.test_pdb_breakpoint_commands[0]>(4)test_function() -> print(2) (Pdb) clear |
