micropython/py
Paul Sokolovsky 7f7c84b10a py/stream: Support both "exact size" and "one underlying call" operations.
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.
2016-05-18 02:41:45 +03:00
..
argcheck.c
asmarm.c
asmarm.h
asmthumb.c
asmthumb.h
asmx64.c
asmx64.h
asmx86.c
asmx86.h
bc.c py: Fix bug passing a string as a keyword arg in a dict. 2016-04-21 16:51:36 +01:00
bc.h
bc0.h
binary.c
binary.h
builtin.h py: Add uerrno module, with errno constants and dict. 2016-05-10 23:30:39 +01:00
builtinevex.c
builtinimport.c py: Add ability to have frozen persistent bytecode from .mpy files. 2016-04-13 16:07:47 +01:00
compile.c py: Fix constant folding and inline-asm to work with new async grammar. 2016-04-13 15:26:39 +01:00
compile.h
emit.h py: Combine continuous block of emit steps into with_cleanup emit call. 2016-04-07 08:50:38 +01:00
emitbc.c py: Combine continuous block of emit steps into with_cleanup emit call. 2016-04-07 08:50:38 +01:00
emitcommon.c
emitglue.c py/emitglue: Fix build on AArch64 (ARMv8, etc.) related to loading .mpy files. 2016-05-12 16:00:57 +03:00
emitglue.h py/emitglue: Make mp_raw_code_t* arguments constant pointers. 2016-04-13 16:05:43 +01:00
emitinlinethumb.c
emitnative.c py/emitnative: Use MP_OBJ_NEW_SMALL_INT instead of manual bit shifting. 2016-04-26 10:02:32 +01:00
formatfloat.c py/formatfloat: Fix further cases of buffer overflow in formatting. 2016-03-29 22:07:15 +01:00
formatfloat.h
frozenmod.c py/frozenmod: Pass the source name of the frozen module to the lexer. 2016-04-17 12:37:00 +01:00
frozenmod.h py: Add ability to have frozen persistent bytecode from .mpy files. 2016-04-13 16:07:47 +01:00
gc.c py/gc: gc_dump_alloc_table(): Dump heap offset instead of actual address. 2016-05-13 00:16:38 +03:00
gc.h
grammar.h py: Simplify "and" action within parser by making ident-rules explicit. 2016-04-14 13:49:23 +01:00
lexer.c py: add async/await/async for/async with syntax 2016-04-13 15:26:38 +01:00
lexer.h py: add async/await/async for/async with syntax 2016-04-13 15:26:38 +01:00
lexerstr.c
lexerunix.c
makeqstrdata.py py/makeqstrdata: Add special case to handle \n qstr. 2016-04-14 15:22:36 +01:00
makeqstrdefs.py py/makeqstrdefs.py: Windows compatibility. 2016-04-25 22:34:22 +01:00
makeversionhdr.py
malloc.c
map.c py/map: Change hash-table allocation policy to be less aggressive. 2016-04-15 16:24:46 +01:00
misc.h
mkenv.mk py/mkenv.mk: Remove -s and -S args from PYTHON variable. 2016-04-21 22:25:35 +01:00
mkrules.mk py/mkrules.mk: Typo fixes in comments. 2016-04-26 12:39:28 +03:00
modarray.c
modbuiltins.c py: add async/await/async for/async with syntax 2016-04-13 15:26:38 +01:00
modcmath.c
modcollections.c py/modcollections: Rename module name have "u" prefix for consistency. 2016-05-02 13:57:46 +03:00
modgc.c
modio.c py/stream: Support both "exact size" and "one underlying call" operations. 2016-05-18 02:41:45 +03:00
modmath.c py/objfloat, py/modmath: Ensure M_PI and M_E defined. 2016-05-12 13:28:45 +01:00
modmicropython.c
modstruct.c py/modstruct: Raise ValueError on unsupported format char. 2016-05-14 15:47:08 +03:00
modsys.c
moduerrno.c py/moduerrno: Add EACCES, pretty common error on Unix. 2016-05-13 00:15:38 +03:00
mpconfig.h py: Add uerrno module, with errno constants and dict. 2016-05-10 23:30:39 +01:00
mperrno.h py/objexcept: Don't convert errno to str in constructor, do it in print. 2016-05-12 14:27:52 +01:00
mphal.h
mpprint.c
mpprint.h
mpstate.c
mpstate.h
mpz.c py/mpz: Fix mpn_div so that it doesn't modify memory of denominator. 2016-05-09 17:21:42 +01:00
mpz.h
nativeglue.c
nlr.h
nlrsetjmp.c
nlrthumb.S
nlrx64.S
nlrx86.S
nlrxtensa.S
obj.c py/obj: Add warning note about get_array return value and GC blocks. 2016-05-04 10:19:08 +01:00
obj.h py/obj: Add warning note about get_array return value and GC blocks. 2016-05-04 10:19:08 +01:00
objarray.c py/objarray: Fix array.append so it doesn't extend if append fails. 2016-04-07 09:03:33 +01:00
objattrtuple.c
objbool.c
objboundmeth.c
objcell.c
objclosure.c
objcomplex.c
objdict.c
objenumerate.c
objexcept.c py/objexcept: Don't convert errno to str in constructor, do it in print. 2016-05-12 14:27:52 +01:00
objexcept.h
objfilter.c
objfloat.c py/objfloat, py/modmath: Ensure M_PI and M_E defined. 2016-05-12 13:28:45 +01:00
objfun.c py/objfun: Allow inline-asm functions to be called with 4 arguments. 2016-03-16 08:22:26 +00:00
objfun.h
objgenerator.c py/vm: "yield from" didn't handle MP_OBJ_STOP_ITERATION optimization. 2016-04-28 02:08:43 +03:00
objgenerator.h
objgetitemiter.c
objint.c
objint.h
objint_longlong.c
objint_mpz.c py/mpz: Do Python style division/modulo within bignum divmod routine. 2016-05-08 22:21:21 +01:00
objlist.c
objlist.h
objmap.c
objmodule.c py: Add uerrno module, with errno constants and dict. 2016-05-10 23:30:39 +01:00
objmodule.h
objnamedtuple.c
objnone.c
objobject.c
objpolyiter.c
objproperty.c
objrange.c
objreversed.c
objset.c
objsingleton.c
objslice.c
objstr.c py/objstr: Make dedicated splitlines function, supporting diff newlines. 2016-05-13 12:21:32 +01:00
objstr.h
objstringio.c py/objstringio: Add TODO comment about avoiding copying on .getvalue(). 2016-05-14 14:46:13 +03:00
objstrunicode.c
objtuple.c
objtuple.h
objtype.c
objtype.h
objzip.c
opmethods.c
parse.c py/parse: Add uerrno to list of modules to look for constants in. 2016-05-10 23:30:39 +01:00
parse.h
parsenum.c py/parsenum: Use pow function to apply exponent to decimal number. 2016-03-29 22:12:07 +01:00
parsenum.h
parsenumbase.c
parsenumbase.h
py.mk py: Add uerrno module, with errno constants and dict. 2016-05-10 23:30:39 +01:00
qstr.c py: Rework QSTR extraction to work in simple and obvious way. 2016-04-19 11:37:56 +03:00
qstr.h py: Rework QSTR extraction to work in simple and obvious way. 2016-04-19 11:37:56 +03:00
qstrdefs.h py: Add rules for automated extraction of qstrs from sources. 2016-04-16 13:18:09 +01:00
repl.c py/repl: Fix handling of backslash in quotes when checking continuation. 2016-05-11 16:05:22 +01:00
repl.h
ringbuf.h py/ringbuf.h: Add reusable ring buffer class. 2016-03-30 14:48:31 +03:00
runtime.c py/runtime: Properly handle passing user mappings to ** keyword args. 2016-05-07 22:02:46 +01:00
runtime.h py: Move call_function_*_protected() functions to py/ for reuse. 2016-04-25 19:31:17 +03:00
runtime0.h
runtime_utils.c py/runtime_utils: Fix nanbox build. 2016-04-25 20:03:14 +03:00
scope.c
scope.h
sequence.c
showbc.c
smallint.c
smallint.h
stackctrl.c
stackctrl.h
stream.c py/stream: Support both "exact size" and "one underlying call" operations. 2016-05-18 02:41:45 +03:00
stream.h py/stream: Support both "exact size" and "one underlying call" operations. 2016-05-18 02:41:45 +03:00
unicode.c
unicode.h
vm.c py/vm: "yield from" didn't handle MP_OBJ_STOP_ITERATION optimization. 2016-04-28 02:08:43 +03:00
vmentrytable.h
vstr.c py/vstr: Change allocation policy, +16 to requested size, instead of *2. 2016-05-10 00:56:51 +03:00
warning.c