kopia lustrzana https://github.com/micropython/micropython
7f7c84b10a
Both read and write operations support variants where either a) a single call is made to the undelying stream implementation and returned buffer length may be less than requested, or b) calls are repeated until requested amount of data is collected, shorter amount is returned only in case of EOF or error. These operations are available from the level of C support functions to be used by other C modules to implementations of Python methods to be used in user-facing objects. The rationale of these changes is to allow to write concise and robust code to work with *blocking* streams of types prone to short reads, like serial interfaces and sockets. Particular object types may select "exact" vs "once" types of methods depending on their needs. E.g., for sockets, revc() and send() methods continue to be "once", while read() and write() thus converted to "exactly" versions. These changes don't affect non-blocking handling, e.g. trying "exact" method on the non-blocking socket will return as much data as available without blocking. No data available is continued to be signaled as None return value to read() and write(). From the point of view of CPython compatibility, this model is a cross between its io.RawIOBase and io.BufferedIOBase abstract classes. For blocking streams, it works as io.BufferedIOBase model (guaranteeing lack of short reads/writes), while for non-blocking - as io.RawIOBase, returning None in case of lack of data (instead of raising expensive exception, as required by io.BufferedIOBase). Such a cross-behavior should be optimal for MicroPython needs. |
||
---|---|---|
.. | ||
argcheck.c | ||
asmarm.c | ||
asmarm.h | ||
asmthumb.c | ||
asmthumb.h | ||
asmx64.c | ||
asmx64.h | ||
asmx86.c | ||
asmx86.h | ||
bc.c | ||
bc.h | ||
bc0.h | ||
binary.c | ||
binary.h | ||
builtin.h | ||
builtinevex.c | ||
builtinimport.c | ||
compile.c | ||
compile.h | ||
emit.h | ||
emitbc.c | ||
emitcommon.c | ||
emitglue.c | ||
emitglue.h | ||
emitinlinethumb.c | ||
emitnative.c | ||
formatfloat.c | ||
formatfloat.h | ||
frozenmod.c | ||
frozenmod.h | ||
gc.c | ||
gc.h | ||
grammar.h | ||
lexer.c | ||
lexer.h | ||
lexerstr.c | ||
lexerunix.c | ||
makeqstrdata.py | ||
makeqstrdefs.py | ||
makeversionhdr.py | ||
malloc.c | ||
map.c | ||
misc.h | ||
mkenv.mk | ||
mkrules.mk | ||
modarray.c | ||
modbuiltins.c | ||
modcmath.c | ||
modcollections.c | ||
modgc.c | ||
modio.c | ||
modmath.c | ||
modmicropython.c | ||
modstruct.c | ||
modsys.c | ||
moduerrno.c | ||
mpconfig.h | ||
mperrno.h | ||
mphal.h | ||
mpprint.c | ||
mpprint.h | ||
mpstate.c | ||
mpstate.h | ||
mpz.c | ||
mpz.h | ||
nativeglue.c | ||
nlr.h | ||
nlrsetjmp.c | ||
nlrthumb.S | ||
nlrx64.S | ||
nlrx86.S | ||
nlrxtensa.S | ||
obj.c | ||
obj.h | ||
objarray.c | ||
objattrtuple.c | ||
objbool.c | ||
objboundmeth.c | ||
objcell.c | ||
objclosure.c | ||
objcomplex.c | ||
objdict.c | ||
objenumerate.c | ||
objexcept.c | ||
objexcept.h | ||
objfilter.c | ||
objfloat.c | ||
objfun.c | ||
objfun.h | ||
objgenerator.c | ||
objgenerator.h | ||
objgetitemiter.c | ||
objint.c | ||
objint.h | ||
objint_longlong.c | ||
objint_mpz.c | ||
objlist.c | ||
objlist.h | ||
objmap.c | ||
objmodule.c | ||
objmodule.h | ||
objnamedtuple.c | ||
objnone.c | ||
objobject.c | ||
objpolyiter.c | ||
objproperty.c | ||
objrange.c | ||
objreversed.c | ||
objset.c | ||
objsingleton.c | ||
objslice.c | ||
objstr.c | ||
objstr.h | ||
objstringio.c | ||
objstrunicode.c | ||
objtuple.c | ||
objtuple.h | ||
objtype.c | ||
objtype.h | ||
objzip.c | ||
opmethods.c | ||
parse.c | ||
parse.h | ||
parsenum.c | ||
parsenum.h | ||
parsenumbase.c | ||
parsenumbase.h | ||
py.mk | ||
qstr.c | ||
qstr.h | ||
qstrdefs.h | ||
repl.c | ||
repl.h | ||
ringbuf.h | ||
runtime.c | ||
runtime.h | ||
runtime0.h | ||
runtime_utils.c | ||
scope.c | ||
scope.h | ||
sequence.c | ||
showbc.c | ||
smallint.c | ||
smallint.h | ||
stackctrl.c | ||
stackctrl.h | ||
stream.c | ||
stream.h | ||
unicode.c | ||
unicode.h | ||
vm.c | ||
vmentrytable.h | ||
vstr.c | ||
warning.c |