##// END OF EJS Templates
Protect Qt console against SyntaxError from input transformers.
Thomas Kluyver -
Show More
@@ -535,8 +535,15 b' class IPythonInputSplitter(InputSplitter):'
535 self.source_raw = ''
535 self.source_raw = ''
536 self.transformer_accumulating = False
536 self.transformer_accumulating = False
537 self.within_python_line = False
537 self.within_python_line = False
538
539 last_exc = None
538 for t in self.transforms:
540 for t in self.transforms:
539 t.reset()
541 try:
542 t.reset()
543 except SyntaxError as e:
544 last_exc = e
545 if last_exc is not None:
546 raise last_exc
540
547
541 def flush_transformers(self):
548 def flush_transformers(self):
542 def _flush(transform, out):
549 def _flush(transform, out):
@@ -204,8 +204,14 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):'
204 prompt created. When triggered by an Enter/Return key press,
204 prompt created. When triggered by an Enter/Return key press,
205 'interactive' is True; otherwise, it is False.
205 'interactive' is True; otherwise, it is False.
206 """
206 """
207 self._input_splitter.reset()
207 try:
208 complete = self._input_splitter.push(source)
208 self._input_splitter.reset()
209 except SyntaxError:
210 pass
211 try:
212 complete = self._input_splitter.push(source)
213 except SyntaxError:
214 return True
209 if interactive:
215 if interactive:
210 complete = not self._input_splitter.push_accepts_more()
216 complete = not self._input_splitter.push_accepts_more()
211 return complete
217 return complete
@@ -233,7 +239,10 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):'
233 """
239 """
234 # Flush all state from the input splitter so the next round of
240 # Flush all state from the input splitter so the next round of
235 # reading input starts with a clean buffer.
241 # reading input starts with a clean buffer.
236 self._input_splitter.reset()
242 try:
243 self._input_splitter.reset()
244 except SyntaxError:
245 pass
237
246
238 if not self._reading:
247 if not self._reading:
239 self._highlighter.highlighting_on = False
248 self._highlighter.highlighting_on = False
General Comments 0
You need to be logged in to leave comments. Login now