##// END OF EJS Templates
Hide the global `quit` from ipdb smart command.
Antony Lee -
Show More
@@ -259,7 +259,15 b' class Pdb(OldPdb, object):'
259 # "Smart command mode" from pdb++: don't execute commands if a variable
259 # "Smart command mode" from pdb++: don't execute commands if a variable
260 # with the same name exists.
260 # with the same name exists.
261 cmd, arg, newline = super(Pdb, self).parseline(line)
261 cmd, arg, newline = super(Pdb, self).parseline(line)
262 if cmd in self.curframe.f_globals or cmd in self.curframe.f_locals:
262 # Fix for #9611: Do not trigger smart command if the command is `exit`
263 # or `quit` and it would resolve to their *global* value (the
264 # `ExitAutocall` object). Just checking that it is not present in the
265 # locals dict is not enough as locals and globals match at the
266 # toplevel.
267 if ((cmd in self.curframe.f_locals or cmd in self.curframe.f_globals)
268 and not (cmd in ["exit", "quit"]
269 and (self.curframe.f_locals is self.curframe.f_globals
270 or cmd not in self.curframe.f_locals))):
263 return super(Pdb, self).parseline("!" + line)
271 return super(Pdb, self).parseline("!" + line)
264 return super(Pdb, self).parseline(line)
272 return super(Pdb, self).parseline(line)
265
273
General Comments 0
You need to be logged in to leave comments. Login now