]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
don't blow up when the charno SyntaxError value is None
authorJust van Rossum <just@letterror.com>
Thu, 21 Jun 2001 21:52:15 +0000 (21:52 +0000)
committerJust van Rossum <just@letterror.com>
Thu, 21 Jun 2001 21:52:15 +0000 (21:52 +0000)
Mac/Tools/IDE/Wtraceback.py

index 2637cc693e02ce9c21a38068cad64e3095f5e4b7..4960ad08d9ac6801b1213889f82b6c585cebd58c 100644 (file)
@@ -55,7 +55,7 @@ class TraceBack:
                        filename = "<unknown>"
                if filename and os.path.exists(filename):
                        filename = os.path.split(filename)[1]
-               if lineno:
+               if lineno and charno is not None:
                        charno = charno - 1
                        text = str(value) + '\rFile: "' + str(filename) + '", line ' + str(lineno) + '\r\r' + line[:charno] + "\xa5" + line[charno:-1]
                else:
@@ -84,6 +84,8 @@ class TraceBack:
                        filename = "<unknown>"
                self.syntaxclose()
                if lineno:
+                       if charno is None:
+                               charno = 1
                        W.getapplication().openscript(filename, lineno, charno - 1)
                else:
                        W.getapplication().openscript(filename)