Hi,
Same root cause as #1038 (fixed for _pty_size) but in terminals.bytes_to_read(), which was not touched by that fix.
On Python 3.14, fcntl.ioctl rejects undersized mutable buffers (cpython#144206). bytes_to_read passes a 2-byte buffer to FIONREAD, which writes a C int (4 bytes):
fionread = fcntl.ioctl(input_, termios.FIONREAD, b" ")
return int(struct.unpack("h", fionread)[0])
which worked by accident on ≤3.13 thanks to the 1024-byte static copy buffer
Repro: any Connection.run() from a TTY-attached process on 3.14 crashes the handle_stdin thread
Do you want me to make a PR a fix with something like fionread = fcntl.ioctl(input_, termios.FIONREAD, b"\x00\x00\x00\x00") in https://github.com/pyinvoke/invoke/blob/main/invoke/terminals.py#L246-L247
Thx.
Hi,
Same root cause as #1038 (fixed for
_pty_size) but interminals.bytes_to_read(), which was not touched by that fix.On Python 3.14,
fcntl.ioctlrejects undersized mutable buffers (cpython#144206).bytes_to_readpasses a 2-byte buffer toFIONREAD, which writes a C int (4 bytes):which worked by accident on ≤3.13 thanks to the 1024-byte static copy buffer
Repro: any
Connection.run()from a TTY-attached process on 3.14 crashes thehandle_stdinthreadDo you want me to make a PR a fix with something like
fionread = fcntl.ioctl(input_, termios.FIONREAD, b"\x00\x00\x00\x00")in https://github.com/pyinvoke/invoke/blob/main/invoke/terminals.py#L246-L247Thx.