← index #6105Issue #3746
Related · high · value 1.693
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

UART readline documentation improvement

closedby nagylzsopened 2018-04-30updated 2020-01-08
docs

I could only try this on the ESP8266 port: the uart.readline() call does not always reads data until the first newline. When the read buffer becomes empty, then readline() returns (even if there was no newline received). The documentation is not clear about this. It only says that uart.readline() will "read a line ending in a newline character". That is not entirely true. It should tell this: "read characters until the first newline character or until the read buffer becomes empty. The readline() method is non-blocking."

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