##// END OF EJS Templates
Backport PR #10050: Revert debugger 'smart command mode'...
Matthias Bussonnier -
Show More
@@ -202,7 +202,7 b' def _file_lines(fname):'
202 return out
202 return out
203
203
204
204
205 class Pdb(OldPdb, object):
205 class Pdb(OldPdb):
206 """Modified Pdb class, does not load readline.
206 """Modified Pdb class, does not load readline.
207
207
208 for a standalone version that uses prompt_toolkit, see
208 for a standalone version that uses prompt_toolkit, see
@@ -288,25 +288,6 b' class Pdb(OldPdb, object):'
288 except KeyboardInterrupt:
288 except KeyboardInterrupt:
289 sys.stdout.write('\n' + self.shell.get_exception_only())
289 sys.stdout.write('\n' + self.shell.get_exception_only())
290
290
291 def parseline(self, line):
292 if line.startswith("!!"):
293 # Force standard behavior.
294 return super(Pdb, self).parseline(line[2:])
295 # "Smart command mode" from pdb++: don't execute commands if a variable
296 # with the same name exists.
297 cmd, arg, newline = super(Pdb, self).parseline(line)
298 # Fix for #9611: Do not trigger smart command if the command is `exit`
299 # or `quit` and it would resolve to their *global* value (the
300 # `ExitAutocall` object). Just checking that it is not present in the
301 # locals dict is not enough as locals and globals match at the
302 # toplevel.
303 if ((cmd in self.curframe.f_locals or cmd in self.curframe.f_globals)
304 and not (cmd in ["exit", "quit"]
305 and (self.curframe.f_locals is self.curframe.f_globals
306 or cmd not in self.curframe.f_locals))):
307 return super(Pdb, self).parseline("!" + line)
308 return super(Pdb, self).parseline(line)
309
310 def new_do_up(self, arg):
291 def new_do_up(self, arg):
311 OldPdb.do_up(self, arg)
292 OldPdb.do_up(self, arg)
312 do_u = do_up = decorate_fn_with_doc(new_do_up, OldPdb.do_up)
293 do_u = do_up = decorate_fn_with_doc(new_do_up, OldPdb.do_up)
General Comments 0
You need to be logged in to leave comments. Login now