Remove use of tuple unpacking and dict.has_key() so as to silence

SyntaxWarning as triggered by -3.
This commit is contained in:
Brett Cannon 2008-08-01 01:36:47 +00:00
parent 791ec1fc13
commit c6a30ecf7a
2 changed files with 5 additions and 4 deletions

View file

@ -131,8 +131,7 @@ class Bdb:
raise NotImplementedError, "subclass of bdb must implement do_clear()" raise NotImplementedError, "subclass of bdb must implement do_clear()"
def break_anywhere(self, frame): def break_anywhere(self, frame):
return self.breaks.has_key( return self.canonic(frame.f_code.co_filename) in self.breaks
self.canonic(frame.f_code.co_filename))
# Derived classes should override the user_* methods # Derived classes should override the user_* methods
# to gain control. # to gain control.
@ -150,7 +149,8 @@ class Bdb:
"""This method is called when a return trap is set here.""" """This method is called when a return trap is set here."""
pass pass
def user_exception(self, frame, (exc_type, exc_value, exc_traceback)): def user_exception(self, frame, exc_info):
exc_type, exc_value, exc_traceback = exc_info
"""This method is called if an exception occurs, """This method is called if an exception occurs,
but only if we are to stop at or just below this level.""" but only if we are to stop at or just below this level."""
pass pass

View file

@ -175,7 +175,8 @@ class Pdb(bdb.Bdb, cmd.Cmd):
print >>self.stdout, '--Return--' print >>self.stdout, '--Return--'
self.interaction(frame, None) self.interaction(frame, None)
def user_exception(self, frame, (exc_type, exc_value, exc_traceback)): def user_exception(self, frame, exc_info):
exc_type, exc_value, exc_traceback = exc_info
"""This function is called if an exception occurs, """This function is called if an exception occurs,
but only if we are to stop at or just below this level.""" but only if we are to stop at or just below this level."""
frame.f_locals['__exception__'] = exc_type, exc_value frame.f_locals['__exception__'] = exc_type, exc_value