<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/compile.c, branch 5.3.x</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=5.3.x</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=5.3.x'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2020-03-01T15:40:43+00:00</updated>
<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>
<entry>
<title>Make the @micropython.native decorator no-op if support isn't enabled</title>
<updated>2019-11-26T21:09:30+00:00</updated>
<author>
<name>Thea Flowers</name>
<email>me@thea.codes</email>
</author>
<published>2019-11-12T20:33:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=84e1d7f304fc92f69eb1120682fe91dff7188ddc'/>
<id>urn:sha1:84e1d7f304fc92f69eb1120682fe91dff7188ddc</id>
<content type='text'>
When adding the ability for boards to turn on the `@micropython.native`, `viper`, and `asm_thumb` decorators it was pointed out that it's somewhat awkward to write libraries and drivers that can take advantage of this since the decorators raise `SyntaxErrors` if they aren't enabled. In the case of `viper` and `asm_thumb` this behavior makes sense as they require writing non-normative code. Drivers could have a normal and viper/thumb implementation and implement them as such:

```python
try:
    import _viper_impl as _impl
except SyntaxError:
    import _python_impl as _impl

def do_thing():
    return _impl.do_thing()
```

For `native`, however, this behavior and the pattern to work around it is less than ideal. Since `native` code should also be valid Python code (although not necessarily the other way around) using the pattern above means *duplicating* the Python implementation and adding `@micropython.native` in the code. This is an unnecessary maintenance burden.

This commit *modifies* the behavior of the `@micropython.native` decorator. On boards with `CIRCUITPY_ENABLE_MPY_NATIVE` turned on it operates as usual. On boards with it turned off it does *nothing*- it doesn't raise a `SyntaxError` and doesn't apply optimizations. This means we can write our drivers/libraries once and take advantage of speedups on boards where they are enabled.
</content>
</entry>
<entry>
<title>Allow boards to enable the `micropython.native` decorator</title>
<updated>2019-11-05T22:27:53+00:00</updated>
<author>
<name>Thea Flowers</name>
<email>me@thea.codes</email>
</author>
<published>2019-10-29T17:11:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=c7195c4bc5a43f0aae731f3030961b60d1db4cac'/>
<id>urn:sha1:c7195c4bc5a43f0aae731f3030961b60d1db4cac</id>
<content type='text'>
Adds the `CIRCUITPY_ENABLE_MPY_NATIVE` for `mpconfigboard.mk` that enables
the `micropython.native` decorator.
</content>
</entry>
<entry>
<title>Compress all translated strings with Huffman coding.</title>
<updated>2018-08-17T00:40:57+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott@tannewt.org</email>
</author>
<published>2018-08-16T01:32:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=de5a9d72dcdaacdd5048195cd5bab007f4b2baef'/>
<id>urn:sha1:de5a9d72dcdaacdd5048195cd5bab007f4b2baef</id>
<content type='text'>
This saves code space in builds which use link-time optimization.
The optimization drops the untranslated strings and replaces them
with a compressed_string_t struct. It can then be decompressed to
a c string.

Builds without LTO work as well but include both untranslated
strings and compressed strings.

This work could be expanded to include QSTRs and loaded strings if
a compress method is added to C. Its tracked in #531.
</content>
</entry>
<entry>
<title>Two fixes and translate more strings.</title>
<updated>2018-08-09T20:29:30+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott@tannewt.org</email>
</author>
<published>2018-08-09T01:24:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=96ebf5bc3fb455162286b9bc31e763f3c4f1c457'/>
<id>urn:sha1:96ebf5bc3fb455162286b9bc31e763f3c4f1c457</id>
<content type='text'>
* Fix finding translations with escaped characters.
* Add back \r to translations since its needed by screen.
</content>
</entry>
<entry>
<title>py/compile: Combine expr, xor_expr and and_expr into one function.</title>
<updated>2018-06-22T07:00:29+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-06-19T04:20:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=25ae98f07cb3c4488cb955403dfe56b8bb8db6f0'/>
<id>urn:sha1:25ae98f07cb3c4488cb955403dfe56b8bb8db6f0</id>
<content type='text'>
This and the previous 4 commits combined have change in code size of:

   bare-arm:   -92
minimal x86:  -544
   unix x64:  -544
unix nanbox:  -712
      stm32:  -116
     cc3200:  -128
    esp8266:  -348
      esp32:  -232
</content>
</entry>
<entry>
<title>py/compile: Combine or_test and and_test compile functions.</title>
<updated>2018-06-22T07:00:29+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-06-19T04:10:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=36e474e83fa26cb78a9312dce5dc53a467c5d8b7'/>
<id>urn:sha1:36e474e83fa26cb78a9312dce5dc53a467c5d8b7</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/compile: Combine global and nonlocal statement compile functions.</title>
<updated>2018-06-22T07:00:29+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-06-19T04:04:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=1a7109d65aa87596c7ce1824037fe298109962e9'/>
<id>urn:sha1:1a7109d65aa87596c7ce1824037fe298109962e9</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/compile: Combine subscript_2 and subscript_3 into one function.</title>
<updated>2018-06-22T07:00:29+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-06-19T03:57:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=d23bec3fc89d1c1f7a2ac8023161e3f2620ffa13'/>
<id>urn:sha1:d23bec3fc89d1c1f7a2ac8023161e3f2620ffa13</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/compile: Combine break and continue compile functions.</title>
<updated>2018-06-22T07:00:29+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-06-19T03:54:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=c14919792868d0e42bb84d61e584797c6c977114'/>
<id>urn:sha1:c14919792868d0e42bb84d61e584797c6c977114</id>
<content type='text'>
</content>
</entry>
</feed>
