mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	M PyShell.py
M rpc.py SF Bug 629987: Idle not printing prompts following SyntaxError
This commit is contained in:
		
							parent
							
								
									a59ef7bbe0
								
							
						
					
					
						commit
						6e44cc2369
					
				
					 2 changed files with 20 additions and 17 deletions
				
			
		|  | @ -1,6 +1,7 @@ | ||||||
| #! /usr/bin/env python | #! /usr/bin/env python | ||||||
| 
 | 
 | ||||||
| import os | import os | ||||||
|  | import os.path | ||||||
| import sys | import sys | ||||||
| import string | import string | ||||||
| import getopt | import getopt | ||||||
|  | @ -24,7 +25,6 @@ | ||||||
| from OutputWindow import OutputWindow | from OutputWindow import OutputWindow | ||||||
| from configHandler import idleConf | from configHandler import idleConf | ||||||
| import idlever | import idlever | ||||||
| import os.path |  | ||||||
| 
 | 
 | ||||||
| import rpc | import rpc | ||||||
| import RemoteDebugger | import RemoteDebugger | ||||||
|  | @ -417,6 +417,7 @@ def execfile(self, filename, source=None): | ||||||
|         except (OverflowError, SyntaxError): |         except (OverflowError, SyntaxError): | ||||||
|             self.tkconsole.resetoutput() |             self.tkconsole.resetoutput() | ||||||
|             InteractiveInterpreter.showsyntaxerror(self, filename) |             InteractiveInterpreter.showsyntaxerror(self, filename) | ||||||
|  |             self.tkconsole.showprompt() | ||||||
|         else: |         else: | ||||||
|             self.runcode(code) |             self.runcode(code) | ||||||
| 
 | 
 | ||||||
|  | @ -458,23 +459,24 @@ def showsyntaxerror(self, filename=None): | ||||||
|         """ |         """ | ||||||
|         text = self.tkconsole.text |         text = self.tkconsole.text | ||||||
|         stuff = self.unpackerror() |         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() | ||||||
|  |             self.write("SyntaxError: %s\n" % str(msg)) | ||||||
|  |         else: | ||||||
|             self.tkconsole.resetoutput() |             self.tkconsole.resetoutput() | ||||||
|             InteractiveInterpreter.showsyntaxerror(self, filename) |             InteractiveInterpreter.showsyntaxerror(self, filename) | ||||||
|             return |         self.tkconsole.showprompt() | ||||||
|         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() |  | ||||||
|         self.write("SyntaxError: %s\n" % str(msg)) |  | ||||||
| 
 | 
 | ||||||
|     def unpackerror(self): |     def unpackerror(self): | ||||||
|         type, value, tb = sys.exc_info() |         type, value, tb = sys.exc_info() | ||||||
|  |  | ||||||
|  | @ -90,7 +90,7 @@ def get_request(self): | ||||||
| 
 | 
 | ||||||
| class SocketIO: | class SocketIO: | ||||||
| 
 | 
 | ||||||
|     debugging = 0 |     debugging = False | ||||||
| 
 | 
 | ||||||
|     def __init__(self, sock, objtable=None, debugging=None): |     def __init__(self, sock, objtable=None, debugging=None): | ||||||
|         self.mainthread = threading.currentThread() |         self.mainthread = threading.currentThread() | ||||||
|  | @ -189,6 +189,7 @@ def asynccall(self, oid, methodname, args, kwargs): | ||||||
| 
 | 
 | ||||||
|     def asyncreturn(self, seq): |     def asyncreturn(self, seq): | ||||||
|         response = self.getresponse(seq) |         response = self.getresponse(seq) | ||||||
|  |         self.debug("asyncreturn:", response) | ||||||
|         return self.decoderesponse(response) |         return self.decoderesponse(response) | ||||||
| 
 | 
 | ||||||
|     def decoderesponse(self, response): |     def decoderesponse(self, response): | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Kurt B. Kaiser
						Kurt B. Kaiser