<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/stream.c, branch v1.8.1</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=v1.8.1</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=v1.8.1'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2016-05-20T18:18:49+00:00</updated>
<entry>
<title>py/stream: Add mp_stream_close() helper function.</title>
<updated>2016-05-20T18:18:49+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2016-05-20T18:16:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=497660fcda77ae819f5ea1f6a92b8fb5006d8213'/>
<id>urn:sha1:497660fcda77ae819f5ea1f6a92b8fb5006d8213</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/stream: Support both "exact size" and "one underlying call" operations.</title>
<updated>2016-05-17T23:41:45+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2016-05-17T23:40:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=7f7c84b10a5f3b2f783955b01f55e0f913ac459f'/>
<id>urn:sha1:7f7c84b10a5f3b2f783955b01f55e0f913ac459f</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>py/stream: Move uPy func obj wrappers to below their respective funcs.</title>
<updated>2016-04-10T11:41:28+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2016-04-10T11:41:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=358e5d8bada558e7197f59221989ff6357a915e4'/>
<id>urn:sha1:358e5d8bada558e7197f59221989ff6357a915e4</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/stream: Simplify arg extraction logic for stream_ioctl.</title>
<updated>2016-04-10T11:37:59+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2016-04-10T11:37:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=657aef66ff3cc308155ea1519ae0c701b326033a'/>
<id>urn:sha1:657aef66ff3cc308155ea1519ae0c701b326033a</id>
<content type='text'>
Saves 16 bytes of code.

Also, use mp_obj_get_int_truncated to allow integers as big as a machine
word to be passed as the value.
</content>
</entry>
<entry>
<title>py/stream: ioctl(): Properly support 2-arg form.</title>
<updated>2016-04-10T10:36:44+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2016-04-10T10:36:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=558fd5d228d3c610958c4aae41b1ede0b6487c35'/>
<id>urn:sha1:558fd5d228d3c610958c4aae41b1ede0b6487c35</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/stream: Fix signed comparison issue.</title>
<updated>2016-04-10T10:31:52+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2016-04-10T10:31:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=6c3db26ab7e03fa0140fb8d3ed315e69717b59ca'/>
<id>urn:sha1:6c3db26ab7e03fa0140fb8d3ed315e69717b59ca</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/stream: Add Python-level ioctl() method.</title>
<updated>2016-04-10T09:45:46+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2016-04-10T09:45:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=0c97e4c4144565ca3b18593d708f0d7a94905c71'/>
<id>urn:sha1:0c97e4c4144565ca3b18593d708f0d7a94905c71</id>
<content type='text'>
Will call underlying C virtual methods of stream interface. This isn't
intended to be added to every stream object (it's not in CPython), but
is convenient way to expose extra operation on Python side without
adding bunch of Python-level methods.
</content>
</entry>
<entry>
<title>py/stream: Fix stupid thinko with variable naming/shadowing.</title>
<updated>2016-03-27T09:58:33+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2016-03-27T09:58:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=53ad5edc01aee3d469feaaafa389be3d686548bb'/>
<id>urn:sha1:53ad5edc01aee3d469feaaafa389be3d686548bb</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/stream: Fix object vs ptr usecase in mp_stream_writeall().</title>
<updated>2016-03-24T17:43:08+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2016-03-24T17:43:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=4a02a8f74ddec92369d8bf2bd51e4191d0d42c5c'/>
<id>urn:sha1:4a02a8f74ddec92369d8bf2bd51e4191d0d42c5c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/stream: Add mp_stream_writeall() helper function.</title>
<updated>2016-03-24T17:09:00+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2016-03-24T17:09:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=d4c8e626f280ab096c1341577931d8071972bd4c'/>
<id>urn:sha1:d4c8e626f280ab096c1341577931d8071972bd4c</id>
<content type='text'>
Spools entire output buffer to a blocking stream (chunk by chunk if
needed).
</content>
</entry>
</feed>
