File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,7 +24,13 @@ def __init__(self, **kwargs):
2424 pdb .Pdb .__init__ (self , stdout = sys .__stdout__ , ** kwargs )
2525 self .prompt = ""
2626
27- if sys .version_info .major == 2 :
27+ ver = sys .version_info
28+ if isinstance (ver , tuple ):
29+ # We're using python <= 2.6
30+ py2 = True
31+ else :
32+ py2 = ver .major == 2
33+ if py2 :
2834 def do_locate (self , arg ):
2935 # An interface can grep the file and line number to follow along.
3036 frame , lineno = self .stack [self .curindex ]
@@ -71,7 +77,7 @@ def main():
7177 except SystemExit :
7278 sys .stdout .write ("The program exited via sys.exit(). " )
7379 sys .stdout .write ("Exit status: %s\n " % sys .exc_info ()[1 ])
74- except Exception as inst :
80+ except Exception as inst : # this syntax assumes python >= 2.6
7581 traceback .print_exc ()
7682 sys .stdout .write ("Uncaught exception %s " % str (type (inst )))
7783 sys .stdout .write ("... entering post-mortem debugging\n " )
You can’t perform that action at this time.
0 commit comments