##// END OF EJS Templates
Only trigger async loop runner when needed. Allows running files that...
Dale Jung -
Show More
@@ -2808,15 +2808,25 b' class InteractiveShell(SingletonConfigurable):'
2808
2808
2809 def _run_cell(self, raw_cell, store_history, silent, shell_futures):
2809 def _run_cell(self, raw_cell, store_history, silent, shell_futures):
2810 """Internal method to run a complete IPython cell."""
2810 """Internal method to run a complete IPython cell."""
2811 return self.loop_runner(
2811 coro = self.run_cell_async(
2812 self.run_cell_async(
2812 raw_cell,
2813 raw_cell,
2813 store_history=store_history,
2814 store_history=store_history,
2814 silent=silent,
2815 silent=silent,
2815 shell_futures=shell_futures,
2816 shell_futures=shell_futures,
2817 )
2818 )
2816 )
2819
2817
2818 try:
2819 interactivity = coro.send(None)
2820 except StopIteration as exc:
2821 return exc.value
2822
2823 if isinstance(interactivity, ExecutionResult):
2824 return interactivity
2825
2826 if interactivity == 'async':
2827 return self.loop_runner(coro)
2828 return _pseudo_sync_runner(coro)
2829
2820 @asyncio.coroutine
2830 @asyncio.coroutine
2821 def run_cell_async(self, raw_cell:str, store_history=False, silent=False, shell_futures=True) -> ExecutionResult:
2831 def run_cell_async(self, raw_cell:str, store_history=False, silent=False, shell_futures=True) -> ExecutionResult:
2822 """Run a complete IPython cell asynchronously.
2832 """Run a complete IPython cell asynchronously.
@@ -2965,6 +2975,9 b' class InteractiveShell(SingletonConfigurable):'
2965 interactivity = "none" if silent else self.ast_node_interactivity
2975 interactivity = "none" if silent else self.ast_node_interactivity
2966 if _run_async:
2976 if _run_async:
2967 interactivity = 'async'
2977 interactivity = 'async'
2978 # yield interactivity so let run_cell decide whether to use
2979 # an async loop_runner
2980 yield interactivity
2968 has_raised = yield from self.run_ast_nodes(code_ast.body, cell_name,
2981 has_raised = yield from self.run_ast_nodes(code_ast.body, cell_name,
2969 interactivity=interactivity, compiler=compiler, result=result)
2982 interactivity=interactivity, compiler=compiler, result=result)
2970
2983
General Comments 0
You need to be logged in to leave comments. Login now