Show More
@@ -308,6 +308,9 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||||
308 | """ |
|
308 | """ | |
309 | self.log.debug("execute: %s", msg.get('content', '')) |
|
309 | self.log.debug("execute: %s", msg.get('content', '')) | |
310 | info = self._request_info.get('execute') |
|
310 | info = self._request_info.get('execute') | |
|
311 | # unset reading flag, because if execute finished, raw_input can't | |||
|
312 | # still be pending. | |||
|
313 | self._reading = False | |||
311 | if info and info.id == msg['parent_header']['msg_id'] and \ |
|
314 | if info and info.id == msg['parent_header']['msg_id'] and \ | |
312 | info.kind == 'user' and not self._hidden: |
|
315 | info.kind == 'user' and not self._hidden: | |
313 | # Make sure that all output from the SUB channel has been processed |
|
316 | # Make sure that all output from the SUB channel has been processed | |
@@ -326,7 +329,7 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||||
326 | self._process_execute_ok(msg) |
|
329 | self._process_execute_ok(msg) | |
327 | elif status == 'error': |
|
330 | elif status == 'error': | |
328 | self._process_execute_error(msg) |
|
331 | self._process_execute_error(msg) | |
329 | elif status == 'abort': |
|
332 | elif status == 'aborted': | |
330 | self._process_execute_abort(msg) |
|
333 | self._process_execute_abort(msg) | |
331 |
|
334 | |||
332 | self._show_interpreter_prompt_for_reply(msg) |
|
335 | self._show_interpreter_prompt_for_reply(msg) | |
@@ -347,6 +350,9 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||||
347 |
|
350 | |||
348 | def callback(line): |
|
351 | def callback(line): | |
349 | self.kernel_manager.stdin_channel.input(line) |
|
352 | self.kernel_manager.stdin_channel.input(line) | |
|
353 | if self._reading: | |||
|
354 | self.log.debug("Got second input request, assuming first was interrupted.") | |||
|
355 | self._reading = False | |||
350 | self._readline(msg['content']['prompt'], callback=callback) |
|
356 | self._readline(msg['content']['prompt'], callback=callback) | |
351 |
|
357 | |||
352 | def _handle_kernel_died(self, since_last_heartbeat): |
|
358 | def _handle_kernel_died(self, since_last_heartbeat): | |
@@ -464,10 +470,15 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||||
464 |
|
470 | |||
465 | def interrupt_kernel(self): |
|
471 | def interrupt_kernel(self): | |
466 | """ Attempts to interrupt the running kernel. |
|
472 | """ Attempts to interrupt the running kernel. | |
|
473 | ||||
|
474 | Also unsets _reading flag, to avoid runtime errors | |||
|
475 | if raw_input is called again. | |||
467 | """ |
|
476 | """ | |
468 | if self.custom_interrupt: |
|
477 | if self.custom_interrupt: | |
|
478 | self._reading = False | |||
469 | self.custom_interrupt_requested.emit() |
|
479 | self.custom_interrupt_requested.emit() | |
470 | elif self.kernel_manager.has_kernel: |
|
480 | elif self.kernel_manager.has_kernel: | |
|
481 | self._reading = False | |||
471 | self.kernel_manager.interrupt_kernel() |
|
482 | self.kernel_manager.interrupt_kernel() | |
472 | else: |
|
483 | else: | |
473 | self._append_plain_text('Kernel process is either remote or ' |
|
484 | self._append_plain_text('Kernel process is either remote or ' |
@@ -372,7 +372,14 b' class IPythonWidget(FrontendWidget):' | |||||
372 | """ |
|
372 | """ | |
373 | # Update the old prompt number if necessary. |
|
373 | # Update the old prompt number if necessary. | |
374 | content = msg['content'] |
|
374 | content = msg['content'] | |
375 | previous_prompt_number = content['execution_count'] |
|
375 | # abort replies do not have any keys: | |
|
376 | if content['status'] == 'aborted': | |||
|
377 | if self._previous_prompt_obj: | |||
|
378 | previous_prompt_number = self._previous_prompt_obj.number | |||
|
379 | else: | |||
|
380 | previous_prompt_number = 0 | |||
|
381 | else: | |||
|
382 | previous_prompt_number = content['execution_count'] | |||
376 | if self._previous_prompt_obj and \ |
|
383 | if self._previous_prompt_obj and \ | |
377 | self._previous_prompt_obj.number != previous_prompt_number: |
|
384 | self._previous_prompt_obj.number != previous_prompt_number: | |
378 | block = self._previous_prompt_obj.block |
|
385 | block = self._previous_prompt_obj.block |
General Comments 0
You need to be logged in to leave comments.
Login now