-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Description
Port, board and/or hardware
rp2
MicroPython version
MicroPython v1.25.0 on 2025-04-15; Raspberry Pi Pico 2 W with RP2350
Reproduction
Call os.dupterm()
with UART or other compatible stream object:
from machine import UART
import os
os.dupterm(UART(0), 0)
Run some code:
import time
i = 0
while True:
print(i)
i += 1
time.sleep(1)
Expected behaviour
While code is running, pressing Ctrl+C
in the USB REPL works as expected:
0
1
2
Traceback (most recent call last):
File "<stdin>", line 6, in <module>
KeyboardInterrupt:
>>>
Observed behaviour
While code is running, pressing Ctrl+C
in the UART REPL fails to send the KeyboardInterrupt
and halt execution.
Below, I pressed Ctrl+C
a few times in the UART REPL, then once in the USB REPL. It then output extra >>>
's for each time I hit Ctrl+C
in the UART REPL, indicating the KeyboardInterrupt
's were getting buffered or something?
0
1
2
3
Traceback (most recent call last):
File "<stdin>", line 6, in <module>
KeyboardInterrupt:
>>>
>>>
>>>
>>>
>>>
Additional Information
Although the provided replication code uses UART, this also happens with a Bluetooth REPL connection and is actually what we need to be fixed. This was just the simplest way to replicate.
Code of Conduct
Yes, I agree