<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/compile.c, branch 6.0.x</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=6.0.x</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=6.0.x'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2020-10-12T05:42:59+00:00</updated>
<entry>
<title>remove unnecessary board configuration and address feedback</title>
<updated>2020-10-12T05:42:59+00:00</updated>
<author>
<name>Kenny</name>
<email>3454741+WarriorOfWire@users.noreply.github.com</email>
</author>
<published>2020-10-12T05:42:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=94beeabc515986e366de569e85d395ab2678ee3d'/>
<id>urn:sha1:94beeabc515986e366de569e85d395ab2678ee3d</id>
<content type='text'>
</content>
</entry>
<entry>
<title>update async tests with less upython workaround and more cpython compatibility</title>
<updated>2020-10-11T06:39:32+00:00</updated>
<author>
<name>Kenny</name>
<email>3454741+WarriorOfWire@users.noreply.github.com</email>
</author>
<published>2020-10-11T06:39:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=98aa4b794346161e512d0fba913901021dd2cfbf'/>
<id>urn:sha1:98aa4b794346161e512d0fba913901021dd2cfbf</id>
<content type='text'>
</content>
</entry>
<entry>
<title>i do not know if this is needed but this is not the vm i use anymore</title>
<updated>2020-10-10T22:45:08+00:00</updated>
<author>
<name>Kenny</name>
<email>3454741+WarriorOfWire@users.noreply.github.com</email>
</author>
<published>2020-10-10T22:30:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=5d96afc5c2e4b4b6aa265a96a3921ac71f036980'/>
<id>urn:sha1:5d96afc5c2e4b4b6aa265a96a3921ac71f036980</id>
<content type='text'>
</content>
</entry>
<entry>
<title>async def syntax rigor and __await__ magic method</title>
<updated>2020-10-10T22:45:08+00:00</updated>
<author>
<name>Kenny</name>
<email>3454741+WarriorOfWire@users.noreply.github.com</email>
</author>
<published>2020-08-06T02:55:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=bf849ff674a953ea36dbffc856a05158b2350077'/>
<id>urn:sha1:bf849ff674a953ea36dbffc856a05158b2350077</id>
<content type='text'>
Some examples of improved compliance with CPython that currently
have divergent behavior in CircuitPython are listed below:

* yield from is not allowed in async methods
```
&gt;&gt;&gt; async def f():
...     yield from 'abc'
...
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 2, in f
SyntaxError: 'yield from' inside async function
```

* await only works on awaitable expressions
```
&gt;&gt;&gt; async def f():
...     await 'not awaitable'
...
&gt;&gt;&gt; f().send(None)
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "&lt;stdin&gt;", line 2, in f
AttributeError: 'str' object has no attribute '__await__'
```

* only __await__()able expressions are awaitable
Okay this one actually does not work in circuitpython at all today.
This is how CPython works though and pretending __await__ does not
exist will only bite users who write both.
```
&gt;&gt;&gt; class c:
...     pass
...
&gt;&gt;&gt; def f(self):
...     yield
...     yield
...     return 'f to pay respects'
...
&gt;&gt;&gt; c.__await__ = f  # could just as easily have put it on the class but this shows how it's wired
&gt;&gt;&gt; async def g():
...     awaitable_thing = c()
...     partial = await awaitable_thing
...     return 'press ' + partial
...
&gt;&gt;&gt; q = g()
&gt;&gt;&gt; q.send(None)
&gt;&gt;&gt; q.send(None)
&gt;&gt;&gt; q.send(None)
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
StopIteration: press f to pay respects
```
</content>
</entry>
<entry>
<title>Merge pull request #3222 from WarriorOfWire/pick_micropython</title>
<updated>2020-07-29T17:54:37+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott@adafruit.com</email>
</author>
<published>2020-07-29T17:54:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=61d1148bb36a022d089af6a4bfb05b96e819d3db'/>
<id>urn:sha1:61d1148bb36a022d089af6a4bfb05b96e819d3db</id>
<content type='text'>
py/compile: Don't await __aiter__ special method in async-for.</content>
</entry>
<entry>
<title>py/compile: Don't await __aiter__ special method in async-for.</title>
<updated>2020-07-25T05:55:37+00:00</updated>
<author>
<name>Jonathan Hogg</name>
<email>me@jonathanhogg.com</email>
</author>
<published>2020-07-21T17:47:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=901f3dce6e5e7c1501550ca0b7f3283848194a2e'/>
<id>urn:sha1:901f3dce6e5e7c1501550ca0b7f3283848194a2e</id>
<content type='text'>
MicroPython's original implementation of __aiter__ was correct for an
earlier (provisional) version of PEP492 (CPython 3.5), where __aiter__ was
an async-def function.  But that changed in the final version of PEP492 (in
CPython 3.5.2) where the function was changed to a normal one.  See
https://www.python.org/dev/peps/pep-0492/#why-aiter-does-not-return-an-awaitable
See also the note at the end of this subsection in the docs:
https://docs.python.org/3.5/reference/datamodel.html#asynchronous-iterators
And for completeness the BPO: https://bugs.python.org/issue27243

To be consistent with the Python spec as it stands today (and now that
PEP492 is final) this commit changes MicroPython's behaviour to match
CPython:  __aiter__ should return an async-iterable object, but is not
itself awaitable.

The relevant tests are updated to match.

See #6267.
</content>
</entry>
<entry>
<title>require async for and async with to actually be in an async def method instead of just a generator</title>
<updated>2020-07-25T02:47:34+00:00</updated>
<author>
<name>Kenny</name>
<email>3454741+WarriorOfWire@users.noreply.github.com</email>
</author>
<published>2020-07-22T05:43:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=9a1f1236ccf9fd525675b8b8ea34178851f968cc'/>
<id>urn:sha1:9a1f1236ccf9fd525675b8b8ea34178851f968cc</id>
<content type='text'>
</content>
</entry>
<entry>
<title>add coroutine behavior for generators</title>
<updated>2020-07-24T03:40:16+00:00</updated>
<author>
<name>Kenny</name>
<email>3454741+WarriorOfWire@users.noreply.github.com</email>
</author>
<published>2020-07-21T07:01:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=51a79b1af7fa663bb078136611705c04df12970a'/>
<id>urn:sha1:51a79b1af7fa663bb078136611705c04df12970a</id>
<content type='text'>
coroutines don't have __next__; they also call themselves coroutines.
This does not change the fact that `async def` methods are generators,
but it does make them behave more like CPython.
</content>
</entry>
<entry>
<title>Add license to some obvious files.</title>
<updated>2020-07-06T18:16:25+00:00</updated>
<author>
<name>Diego Elio Pettenò</name>
<email>flameeyes@flameeyes.com</email>
</author>
<published>2020-06-03T22:40:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=34b4993d63a6b576f29d624385c681f679b4124c'/>
<id>urn:sha1:34b4993d63a6b576f29d624385c681f679b4124c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>compile: Give a proper error on 'async with'/'async for' outside 'async def'</title>
<updated>2020-03-01T15:40:43+00:00</updated>
<author>
<name>Jeff Epler</name>
<email>jepler@gmail.com</email>
</author>
<published>2020-03-01T15:40:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=862830da322b52680cc809a25985636f608aa42d'/>
<id>urn:sha1:862830da322b52680cc809a25985636f608aa42d</id>
<content type='text'>
A simple reproducer is:
   async for x in():x
</content>
</entry>
</feed>
