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

uasyncio StreamReader.read(n) CPython incompatibility

closedby peterhinchopened 2020-08-21updated 2022-06-24
extmod

MicroPython requires a value n while the CPython method has a default value n=-1. See the docs:

coroutine read(n=-1)
Read up to n bytes. If n is not provided, or set to -1, read until EOF and return all read bytes.
If EOF was received and the internal buffer is empty, return an empty bytes object.

Raised by this user.

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