]> granicus.if.org Git - python/commitdiff
M PyShell.py
authorKurt B. Kaiser <kbk@shore.net>
Sat, 30 Nov 2002 06:18:00 +0000 (06:18 +0000)
committerKurt B. Kaiser <kbk@shore.net>
Sat, 30 Nov 2002 06:18:00 +0000 (06:18 +0000)
M rpc.py

SF Bug 629987: Idle not printing prompts following SyntaxError

Lib/idlelib/PyShell.py
Lib/idlelib/rpc.py

index ad8263d68183ca7e299e5521a9795c7410aa6ac4..3fc814b4c169f4fc5e664ed9c80da076bb9efdbf 100644 (file)
@@ -1,6 +1,7 @@
 #! /usr/bin/env python
 
 import os
+import os.path
 import sys
 import string
 import getopt
@@ -24,7 +25,6 @@ from UndoDelegator import UndoDelegator
 from OutputWindow import OutputWindow
 from configHandler import idleConf
 import idlever
-import os.path
 
 import rpc
 import RemoteDebugger
@@ -417,6 +417,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
         except (OverflowError, SyntaxError):
             self.tkconsole.resetoutput()
             InteractiveInterpreter.showsyntaxerror(self, filename)
+            self.tkconsole.showprompt()
         else:
             self.runcode(code)
 
@@ -458,23 +459,24 @@ class ModifiedInterpreter(InteractiveInterpreter):
         """
         text = self.tkconsole.text
         stuff = self.unpackerror()
-        if not stuff:
+        if stuff:
+            msg, lineno, offset, line = stuff
+            if lineno == 1:
+                pos = "iomark + %d chars" % (offset-1)
+            else:
+                pos = "iomark linestart + %d lines + %d chars" % \
+                      (lineno-1, offset-1)
+            text.tag_add("ERROR", pos)
+            text.see(pos)
+            char = text.get(pos)
+            if char and char in IDENTCHARS:
+                text.tag_add("ERROR", pos + " wordstart", pos)
             self.tkconsole.resetoutput()
-            InteractiveInterpreter.showsyntaxerror(self, filename)
-            return
-        msg, lineno, offset, line = stuff
-        if lineno == 1:
-            pos = "iomark + %d chars" % (offset-1)
+            self.write("SyntaxError: %s\n" % str(msg))
         else:
-            pos = "iomark linestart + %d lines + %d chars" % (lineno-1,
-                                                              offset-1)
-        text.tag_add("ERROR", pos)
-        text.see(pos)
-        char = text.get(pos)
-        if char and char in IDENTCHARS:
-            text.tag_add("ERROR", pos + " wordstart", pos)
-        self.tkconsole.resetoutput()
-        self.write("SyntaxError: %s\n" % str(msg))
+            self.tkconsole.resetoutput()
+            InteractiveInterpreter.showsyntaxerror(self, filename)
+        self.tkconsole.showprompt()
 
     def unpackerror(self):
         type, value, tb = sys.exc_info()
index eeb1b4efd44b00ad9a54880c6dc7f9995e9e2bc5..4bbf0bb786a7ca4b6147fb9d0515a73f8cd5c591 100644 (file)
@@ -90,7 +90,7 @@ objecttable = {}
 
 class SocketIO:
 
-    debugging = 0
+    debugging = False
 
     def __init__(self, sock, objtable=None, debugging=None):
         self.mainthread = threading.currentThread()
@@ -189,6 +189,7 @@ class SocketIO:
 
     def asyncreturn(self, seq):
         response = self.getresponse(seq)
+        self.debug("asyncreturn:", response)
         return self.decoderesponse(response)
 
     def decoderesponse(self, response):