py/stream: Add a stream.readinto1() method for machine.UART.

Avoiding the double timeout when used with the UART class.
`stream.readinto1()` returns after the first timeout.

Fixes issue #17611.

Signed-off-by: robert-hh <robert@hammelrath.com>
This commit is contained in:
robert-hh
2025-08-16 14:43:37 +02:00
committed by Damien George
parent c50f9cbb42
commit 66fb82e44e
4 changed files with 14 additions and 4 deletions

View File

@@ -583,7 +583,7 @@ static const mp_rom_map_elem_t pyb_uart_locals_dict_table[] = {
/// \method readline()
{ MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj) },
/// \method readinto(buf[, nbytes])
{ MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
{ MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto1_obj) },
/// \method write(buf)
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write1_obj) },
{ MP_ROM_QSTR(MP_QSTR_flush), MP_ROM_PTR(&mp_stream_flush_obj) },