Fixed an interesting issue showing up when the code contains an invalid future statement.

Fri, 30 Sep 2016 19:21:22 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 30 Sep 2016 19:21:22 +0200
changeset 5184
79b3922094ba
parent 5182
e2782c9a43d4
child 5185
a55cbfbd715e

Fixed an interesting issue showing up when the code contains an invalid future statement.

DebugClients/Python2/DebugBase.py file | annotate | diff | comparison | revisions
DebugClients/Python3/DebugBase.py file | annotate | diff | comparison | revisions
DebugClients/Python3/DebugClientBase.py file | annotate | diff | comparison | revisions
--- a/DebugClients/Python2/DebugBase.py	Wed Sep 28 20:04:44 2016 +0200
+++ b/DebugClients/Python2/DebugBase.py	Fri Sep 30 19:21:22 2016 +0200
@@ -742,7 +742,18 @@
         
         if exctype in [SyntaxError, IndentationError]:
             try:
-                message, (filename, lineno, charno, text) = excval
+                if type(excval) == tuple:
+                    message, (filename, lineno, charno, text) = excval
+                else:
+                    message = excval.msg
+                    filename = excval.filename
+                    lineno = excval.lineno
+                    charno = excval.offset
+                    if charno is None:
+                        charno = 0
+                
+                filename = os.path.abspath(filename)
+                realSyntaxError = os.path.exists(filename)
             except ValueError:
                 message = ""
                 filename = ""
--- a/DebugClients/Python3/DebugBase.py	Wed Sep 28 20:04:44 2016 +0200
+++ b/DebugClients/Python3/DebugBase.py	Fri Sep 30 19:21:22 2016 +0200
@@ -754,10 +754,13 @@
         
         if exctype in [SyntaxError, IndentationError]:
             try:
+                printerr("1")
                 message = str(excval)
                 filename = excval.filename
                 lineno = excval.lineno
                 charno = excval.offset
+                if charno is None:
+                    charno = 0
                 realSyntaxError = os.path.exists(filename)
             except (AttributeError, ValueError):
                 message = ""
--- a/DebugClients/Python3/DebugClientBase.py	Wed Sep 28 20:04:44 2016 +0200
+++ b/DebugClients/Python3/DebugClientBase.py	Fri Sep 30 19:21:22 2016 +0200
@@ -352,6 +352,8 @@
                 filename = excval.filename
                 lineno = excval.lineno
                 charno = excval.offset
+                if charno is None:
+                    charno = 0
             except (AttributeError, ValueError):
                 message = ""
                 filename = ""

eric ide

mercurial