<feed xmlns='http://www.w3.org/2005/Atom'>
<title>openmano-mpy/extmod/uasyncio, branch master</title>
<subtitle>MicroPython source and hardware configuration for OpenMano</subtitle>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/'/>
<entry>
<title>extmod/uasyncio: Use .errno instead of .args[0] for OSError exceptions.</title>
<updated>2021-04-23T12:03:46+00:00</updated>
<author>
<name>Damien George</name>
</author>
<published>2021-04-20T07:12:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=342d55529d6f3312fc158d7af005f56d5e30adef'/>
<id>342d55529d6f3312fc158d7af005f56d5e30adef</id>
<content type='text'>
Signed-off-by: Damien George &lt;damien@micropython.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Damien George &lt;damien@micropython.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>extmod/uasyncio: Add ThreadSafeFlag.</title>
<updated>2021-02-16T05:35:37+00:00</updated>
<author>
<name>Jim Mussared</name>
</author>
<published>2021-02-12T03:14:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=5e96e89999cd3b922dbc1a6ed473b44c81db92f4'/>
<id>5e96e89999cd3b922dbc1a6ed473b44c81db92f4</id>
<content type='text'>
This is a MicroPython-extension that allows for code running in IRQ
(hard or soft) or scheduler context to sequence asyncio code.

Signed-off-by: Jim Mussared &lt;jim.mussared@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is a MicroPython-extension that allows for code running in IRQ
(hard or soft) or scheduler context to sequence asyncio code.

Signed-off-by: Jim Mussared &lt;jim.mussared@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>extmod/uasyncio: Add asyncio.current_task().</title>
<updated>2021-02-13T04:11:17+00:00</updated>
<author>
<name>Jim Mussared</name>
</author>
<published>2021-02-12T03:11:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=7ed99544e4cc1c09bd5abf9f54869c3122fa033b'/>
<id>7ed99544e4cc1c09bd5abf9f54869c3122fa033b</id>
<content type='text'>
Matches CPython behavior.

Fixes #6686
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Matches CPython behavior.

Fixes #6686
</pre>
</div>
</content>
</entry>
<entry>
<title>extmod/uasyncio: Fix cancellation handling of wait_for.</title>
<updated>2020-12-02T01:31:37+00:00</updated>
<author>
<name>Damien George</name>
</author>
<published>2020-12-01T03:22:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=b505971069333a373d9f0c12138b64dab83fed72'/>
<id>b505971069333a373d9f0c12138b64dab83fed72</id>
<content type='text'>
This commit switches the roles of the helper task from a cancellation task
to a runner task, to get the correct semantics for cancellation of
wait_for.

Some uasyncio tests are now disabled for the native emitter due to issues
with native code generation of generators and yield-from.

Fixes #5797.

Signed-off-by: Damien George &lt;damien@micropython.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit switches the roles of the helper task from a cancellation task
to a runner task, to get the correct semantics for cancellation of
wait_for.

Some uasyncio tests are now disabled for the native emitter due to issues
with native code generation of generators and yield-from.

Fixes #5797.

Signed-off-by: Damien George &lt;damien@micropython.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>extmod/uasyncio: Add Task.done() method.</title>
<updated>2020-12-02T01:07:06+00:00</updated>
<author>
<name>Damien George</name>
</author>
<published>2020-11-30T06:38:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=309dfe39e07d3c3c8ba873ed09116cea9f6f52c0'/>
<id>309dfe39e07d3c3c8ba873ed09116cea9f6f52c0</id>
<content type='text'>
This is added because task.coro==None is no longer the way to detect if a
task is finished.  Providing a (CPython compatible) function for this
allows the implementation to be abstracted away.

Signed-off-by: Damien George &lt;damien@micropython.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is added because task.coro==None is no longer the way to detect if a
task is finished.  Providing a (CPython compatible) function for this
allows the implementation to be abstracted away.

Signed-off-by: Damien George &lt;damien@micropython.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>extmod/uasyncio: Delay calling Loop.call_exception_handler by 1 loop.</title>
<updated>2020-12-02T01:07:06+00:00</updated>
<author>
<name>Damien George</name>
</author>
<published>2020-11-30T06:38:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=ca40eb0fdadd5a963b9a065999b092f029a598d5'/>
<id>ca40eb0fdadd5a963b9a065999b092f029a598d5</id>
<content type='text'>
When a tasks raises an exception which is uncaught, and no other task
await's on that task, then an error message is printed (or a user function
called) via a call to Loop.call_exception_handler.  In CPython this call is
made when the Task object is freed (eg via reference counting) because it's
at that point that it is known that the exception that was raised will
never be handled.

MicroPython does not have reference counting and the current behaviour is
to deal with uncaught exceptions as early as possible, ie as soon as they
terminate the task.  But this can be undesirable because in certain cases
a task can start and raise an exception immediately (before any await is
executed in that task's coro) and before any other task gets a chance to
await on it to catch the exception.

This commit changes the behaviour so that tasks which end due to an
uncaught exception are scheduled one more time for execution, and if they
are not await'ed on by the next scheduling loop, then the exception handler
is called (eg the exception is printed out).

Signed-off-by: Damien George &lt;damien@micropython.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When a tasks raises an exception which is uncaught, and no other task
await's on that task, then an error message is printed (or a user function
called) via a call to Loop.call_exception_handler.  In CPython this call is
made when the Task object is freed (eg via reference counting) because it's
at that point that it is known that the exception that was raised will
never be handled.

MicroPython does not have reference counting and the current behaviour is
to deal with uncaught exceptions as early as possible, ie as soon as they
terminate the task.  But this can be undesirable because in certain cases
a task can start and raise an exception immediately (before any await is
executed in that task's coro) and before any other task gets a chance to
await on it to catch the exception.

This commit changes the behaviour so that tasks which end due to an
uncaught exception are scheduled one more time for execution, and if they
are not await'ed on by the next scheduling loop, then the exception handler
is called (eg the exception is printed out).

Signed-off-by: Damien George &lt;damien@micropython.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>extmod/uasyncio: Truncate negative sleeps to 0.</title>
<updated>2020-08-22T02:17:06+00:00</updated>
<author>
<name>Damien George</name>
</author>
<published>2020-08-20T13:13:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=55c76eaac12af4e93f8de11bb25c835e8b65c623'/>
<id>55c76eaac12af4e93f8de11bb25c835e8b65c623</id>
<content type='text'>
Otherwise a task that continuously awaits on a large negative sleep can
monopolise the scheduler (because its wake time is always less than
everything else in the pairing heap).

Signed-off-by: Damien George &lt;damien@micropython.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Otherwise a task that continuously awaits on a large negative sleep can
monopolise the scheduler (because its wake time is always less than
everything else in the pairing heap).

Signed-off-by: Damien George &lt;damien@micropython.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>extmod/uasyncio: Add StreamReader.readexactly(n) method.</title>
<updated>2020-07-25T13:10:05+00:00</updated>
<author>
<name>Damien George</name>
</author>
<published>2020-07-25T13:05:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=441460d81ff2b1faee7d044d859896f754361b93'/>
<id>441460d81ff2b1faee7d044d859896f754361b93</id>
<content type='text'>
It raises on EOFError instead of an IncompleteReadError (which is what
CPython does).  But the latter is derived from EOFError so code compatible
with MicroPython and CPython can be written by catching EOFError (eg see
included test).

Fixes issue #6156.

Signed-off-by: Damien George &lt;damien@micropython.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It raises on EOFError instead of an IncompleteReadError (which is what
CPython does).  But the latter is derived from EOFError so code compatible
with MicroPython and CPython can be written by catching EOFError (eg see
included test).

Fixes issue #6156.

Signed-off-by: Damien George &lt;damien@micropython.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>extmod/uasyncio: Add asyncio.wait_for_ms function.</title>
<updated>2020-06-10T12:29:44+00:00</updated>
<author>
<name>Damien George</name>
</author>
<published>2020-06-05T11:26:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=a4c96fb3b0c5e3bf83238a0edd0fbcbfd96208c8'/>
<id>a4c96fb3b0c5e3bf83238a0edd0fbcbfd96208c8</id>
<content type='text'>
Fixes issue #6107.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes issue #6107.
</pre>
</div>
</content>
</entry>
<entry>
<title>extmod/uasyncio: Change cannot to can't in error message, and test exp.</title>
<updated>2020-04-14T11:51:25+00:00</updated>
<author>
<name>Damien George</name>
</author>
<published>2020-04-14T11:51:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=5f0661b4fe6a68c38e9eecd94845f4bd1ed3046a'/>
<id>5f0661b4fe6a68c38e9eecd94845f4bd1ed3046a</id>
<content type='text'>
Follow up to 8e048d2548867aac743866ca5a4c244b7b5aac09 which missed these.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Follow up to 8e048d2548867aac743866ca5a4c244b7b5aac09 which missed these.
</pre>
</div>
</content>
</entry>
</feed>
