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

Đang mở
#1,550 1 bình luận 1 reaction 1 người được giao Xem trên GitHub

@Carreau đang làm issue này rồi.

Từ ngày 26/8/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

Consider

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).

Ngôn ngữ chính
Python
Star
734
Fork
411
Merge trung bình
1 ngày 5 giờ
Pull request đã merge (30 ngày)
8

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ipython/ipykernel

Tất cả issue của ipython/ipykernel

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.