Skip to content
Snippets Groups Projects
Commit 2f7c0398 authored by Pierre Gergondet's avatar Pierre Gergondet
Browse files

Fixes #5

Reimplement runsource to reset the cache in case of SyntaxError

Behaviour of runsource based on:
http://docs.python.org/2/library/code.html
parent 2ba47b22
No related branches found
No related tags found
No related merge requests found
...@@ -50,6 +50,18 @@ class RosShell(InteractiveConsole): ...@@ -50,6 +50,18 @@ class RosShell(InteractiveConsole):
self.cache = source self.cache = source
self.runcode(code, False) self.runcode(code, False)
def runsource(self, source, filename = '<input>', symbol = 'single'):
try:
c = code.compile_command(source, filename, symbol)
if c:
return InteractiveConsole.runcode(self, c)
else:
return True
except SyntaxError, OverflowError:
self.showsyntaxerror()
self.cache = ""
return False
def push(self,line): def push(self,line):
self.cache += line + "\n" self.cache += line + "\n"
return InteractiveConsole.push(self,line) return InteractiveConsole.push(self,line)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment