uv
uv copied to clipboard
SIGINT is being handled very strangely in interactive shell
Summary
Expected Behavior
python3.12
Python 3.12.3 (main, Feb 4 2025, 14:48:35) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
KeyboardInterrupt
>>>
>>>
KeyboardInterrupt
>>>
>>>
In a normal interactive Python shell, when I press SIGINT, it just sends only one interrupt, which is a normal behavior
Actual Behavior (uv python interactive shell)
uv run python
Python 3.12.3 (main, Feb 4 2025, 14:48:35) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
KeyboardInterrupt
>>>
>>>
KeyboardInterrupt
>>>
KeyboardInterrupt
>>>
>>>
KeyboardInterrupt
>>>
KeyboardInterrupt
>>>
>>>
In the uv run interactive Python shell, when I press SIGINT for the first time, I get only an interrupt, which is okay, however, second, third, and subsequent SIGINT interrupt gets executed twice, so I get two interrupts in the strange console output. Also, after SIGINT key press, I guess Enter key gets pressed first, and then only interrupt, which feels even more bizarre.
Actual Behavior (docker uv python interactive shell)
docker run --rm -it ghcr.io/astral-sh/uv:python3.12-bookworm-slim uv run python
Python 3.12.10 (main, Apr 28 2025, 22:12:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
KeyboardInterrupt
>>>
>>>
KeyboardInterrupt
>>>
KeyboardInterrupt
>>>
>>>
KeyboardInterrupt
>>>
KeyboardInterrupt
>>>
>>>
So the same problem can be observed both from the Docker container and from the host
Platform
Ubuntu 24.04.2 LTS
Version
uv 0.7.3
Python version
Python 3.12.3 Python 3.12.10