prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.1k stars 717 forks source link

Fix compatibility when SIGINT handler is installed by non-Python #1865

Closed quark-zju closed 1 month ago

quark-zju commented 2 months ago

When a native (Rust, C) program installs SIGINT handler and calls into Python, signal.getsignal can return None, which is not a valid value for the 2nd parameter of signal.signal. Fix it by checking None explicitly.

jonathanslenders commented 1 month ago

Thanks!