← index #6105Issue #5335
Related · medium · value 0.620
QUERY · ISSUE

uasyncio V3 stream readline: is this correct?

openby peterhinchopened 2020-06-02updated 2020-06-04
extmod

The readline method returns if the final character is a newline. However it is possible that self.s.readline() might return more than one line. Should Stream.readline find the first newline and return a partial result? CPython docs:

Read one line, where “line” is a sequence of bytes ending with \n.

In the existing design the onus is on the device s to return a maximum of one line. Is this correct?

CANDIDATE · ISSUE

USB_VCP.readline() does not read whole line

openby shamlianopened 2019-11-15updated 2019-11-18
port-stm32

On a pyboard, I am having some trouble with USB_VCP.readline(); it seems to return whatever is in the buffer, even if it's not a full line. I would have expected the function to return None until a newline character is received, as if I were reading from a file. Is this expected? I noticed that the documentation text for USB_VCP's implementation of readline() is different than the text for UART and socket; I'm hoping this isn't a sign that they are supposed to work differently.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied