Show More
@@ -308,6 +308,9 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||
|
308 | 308 | """ |
|
309 | 309 | self.log.debug("execute: %s", msg.get('content', '')) |
|
310 | 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 | 314 | if info and info.id == msg['parent_header']['msg_id'] and \ |
|
312 | 315 | info.kind == 'user' and not self._hidden: |
|
313 | 316 | # Make sure that all output from the SUB channel has been processed |
@@ -326,7 +329,7 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||
|
326 | 329 | self._process_execute_ok(msg) |
|
327 | 330 | elif status == 'error': |
|
328 | 331 | self._process_execute_error(msg) |
|
329 | elif status == 'abort': | |
|
332 | elif status == 'aborted': | |
|
330 | 333 | self._process_execute_abort(msg) |
|
331 | 334 | |
|
332 | 335 | self._show_interpreter_prompt_for_reply(msg) |
@@ -347,6 +350,9 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||
|
347 | 350 | |
|
348 | 351 | def callback(line): |
|
349 | 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 | 356 | self._readline(msg['content']['prompt'], callback=callback) |
|
351 | 357 | |
|
352 | 358 | def _handle_kernel_died(self, since_last_heartbeat): |
@@ -464,10 +470,15 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||
|
464 | 470 | |
|
465 | 471 | def interrupt_kernel(self): |
|
466 | 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 | 477 | if self.custom_interrupt: |
|
478 | self._reading = False | |
|
469 | 479 | self.custom_interrupt_requested.emit() |
|
470 | 480 | elif self.kernel_manager.has_kernel: |
|
481 | self._reading = False | |
|
471 | 482 | self.kernel_manager.interrupt_kernel() |
|
472 | 483 | else: |
|
473 | 484 | self._append_plain_text('Kernel process is either remote or ' |
@@ -372,7 +372,14 b' class IPythonWidget(FrontendWidget):' | |||
|
372 | 372 | """ |
|
373 | 373 | # Update the old prompt number if necessary. |
|
374 | 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 | 383 | if self._previous_prompt_obj and \ |
|
377 | 384 | self._previous_prompt_obj.number != previous_prompt_number: |
|
378 | 385 | block = self._previous_prompt_obj.block |
General Comments 0
You need to be logged in to leave comments.
Login now