()
| 198 | # Create `eval` task. Ensure that control-c will cancel this |
| 199 | # task. |
| 200 | async def eval() -> Any: |
| 201 | nonlocal system_exit |
| 202 | try: |
| 203 | return await self.eval_async(text) |
| 204 | except SystemExit as e: |
| 205 | # Don't propagate SystemExit in `create_task()`. That |
| 206 | # will kill the event loop. We want to handle it |
| 207 | # gracefully. |
| 208 | system_exit = e |
| 209 | |
| 210 | task = asyncio.create_task(eval()) |
| 211 | loop.add_signal_handler(signal.SIGINT, lambda *_: task.cancel()) |
no test coverage detected