ipython / ipython/ipykernel

Interrupt on swallowed `KeyboardInterrupt` exceptions (`SIGINT`) when pressing twice (within 5 seconds)

オープン
#1,550 コメント 1 件 リアクション 1 件 担当者 1 名 @Carreau が担当を希望しています GitHub で見る
主要言語
Python
スター
734
フォーク
412
平均マージ
1日 5時間
マージ済み PR(30日)
8

説明

Consider

```python
import time
while True:
try:
time.sleep(1)
except BaseException:
pass
```

It is impossible to interrupt. But it does not have to be! With Python 3.12 we now have `sys.monitoring` and could instead show:

> The running code caught the interrupt and kept going. Interrupt again within 5 seconds to force it to stop.

Current behaviour:

https://github.com/user-attachments/assets/aa51f4cc-afb3-4d6b-9d4f-cc32361417a3

Proposed behaviour:

https://github.com/user-attachments/assets/f5e891d1-fa78-4c7a-87af-ff0d3458c146

This would be similar to what jupyter-server does for interrupts with Ctrl + C (pressing it twice forces shutdown).

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。