Commit Graph

15528 Commits

Author SHA1 Message Date
Scott Shawcroft
eebe769973
Merge pull request #2692 from jepler/ulab-upstream
ulab: Use https://github.com/v923z/micropython-ulab/
2020-03-09 16:28:56 -07:00
Jeff Epler
491a31a731 circuitpy_mpconfig.mk: Enable ULAB for "full builds"
This enables it on the imxrt and cds56 ports where it was disabled before
2020-03-09 15:54:40 -05:00
Jeff Epler
66aa0dec60 stm32: enable ulab
This is needed because stm32 defines CIRCUITPY_MINIMAL_BUILD "for early
port".
2020-03-09 15:54:40 -05:00
Jeff Epler
e128d770f1 cdx56: prepare to enable ulab
This involves fixing support for SRC_MOD and enabling INTERNAL_LIBM
including adding support for SRC_LIBM.
2020-03-09 15:54:40 -05:00
Jeff Epler
eab9b670d8 ulab: Use https://github.com/v923z/micropython-ulab/
The only delta we were carrying was in the README.
2020-03-09 14:48:52 -05:00
Jeff Epler
473e9c5ffb f-strings: Make optional, defaulting to !CIRCUITPY_MINIMAL_BUILD
This should reclaim *most* code space added to handle f-strings.
However, there may be some small code growth as parse_string_literal
takes a new parameter (which will always be 0, so hopefully the optimizer
eliminates it)
2020-03-09 09:03:25 -05:00
Jeff Epler
32647cd9b4 lexer: catch concatenation of f'' and '' strings
This turns the "edge case" into a parse-time error.
2020-03-09 09:03:25 -05:00
Jeff Epler
acd7b8932f locale: run 'make translate' 2020-03-09 08:19:46 -05:00
Josh Klar
40bc05ee1e Address dpgeorge feedback - largely simplifications 2020-03-09 08:16:07 -05:00
Josh Klar
3a7a5ba686 py: Implement partial PEP-498 (f-string) support
This implements (most of) the PEP-498 spec for f-strings, with two
exceptions:

- raw f-strings (`fr` or `rf` prefixes) raise `NotImplementedError`
- one special corner case does not function as specified in the PEP
(more on that in a moment)

This is implemented in the core as a syntax translation, brute-forcing
all f-strings to run through `String.format`. For example, the statement
`x='world'; print(f'hello {x}')` gets translated *at a syntax level*
(injected into the lexer) to `x='world'; print('hello {}'.format(x))`.
While this may lead to weird column results in tracebacks, it seemed
like the fastest, most efficient, and *likely* most RAM-friendly option,
despite being implemented under the hood with a completely separate
`vstr_t`.

Since [string concatenation of adjacent literals is implemented in the
lexer](534b7c368d),
two side effects emerge:

- All strings with at least one f-string portion are concatenated into a
single literal which *must* be run through `String.format()` wholesale,
and:
- Concatenation of a raw string with interpolation characters with an
f-string will cause `IndexError`/`KeyError`, which is both different
from CPython *and* different from the corner case mentioned in the PEP
(which gave an example of the following:)

```python
x = 10
y = 'hi'
assert ('a' 'b' f'{x}' '{c}' f'str<{y:^4}>' 'd' 'e') == 'ab10{c}str< hi >de'
```

The above-linked commit detailed a pretty solid case for leaving string
concatenation in the lexer rather than putting it in the parser, and
undoing that decision would likely be disproportionately costly on
resources for the sake of a probably-low-impact corner case. An
alternative to become complaint with this corner case of the PEP would
be to revert to string concatenation in the parser *only when an
f-string is part of concatenation*, though I've done no investigation on
the difficulty or costs of doing this.

A decent set of tests is included. I've manually tested this on the
`unix` port on Linux and on a Feather M4 Express (`atmel-samd`) and
things seem sane.
2020-03-09 08:16:07 -05:00
Limor "Ladyada" Fried
83d5da95b7
Merge pull request #2684 from caternuson/doc_add_sensors
Add proximity and sound_level to Design Guide
2020-03-06 18:10:47 -05:00
caternuson
125409fe95 add proximity and sound_level 2020-03-06 13:31:08 -08:00
TG-Techie
fec84054d9 ah 2020-03-06 15:03:37 -05:00
Dan Halbert
fdcdc1320b Make ParallelBus reset ping arg required 2020-03-06 14:30:30 -05:00
TG-Techie
7198056bc3
Merge pull request #2 from adafruit/5.0.x
5.0.x
2020-03-06 13:57:31 -05:00
TG-Techie
03dfd28121 trying to pull 5.0.x 2020-03-06 13:52:47 -05:00
Dan Halbert
127e6fa27e Revert "try actions/checkout@v2"
This reverts commit b492ea69cb.
2020-03-05 23:13:14 -05:00
Dan Halbert
b492ea69cb try actions/checkout@v2 2020-03-05 23:06:30 -05:00
Dan Halbert
210c3274e5 Merge remote-tracking branch 'adafruit/master' into assert_pin-and-mp_const_none-cleanup 2020-03-05 17:47:01 -05:00
Dan Halbert
817b5be320 rename routines to be clearer; fix wiznet arg types 2020-03-05 16:35:31 -05:00
Jeff Epler
4fa90261a3
Merge pull request #2657 from tannewt/builtin_package
Support importing native modules in native packages.
2020-03-05 14:28:46 -06:00
Dan Halbert
e81930fb9e
Merge pull request #2681 from theacodes/disable-hid-on-sol
Disable the HID USB descriptor for Sol
2020-03-05 09:31:16 -05:00
Thea Flowers
409a4a9490 Disable the HID USB descriptor for Sol
It's not used and ends up being confusing for folks.
2020-03-04 23:22:46 -08:00
Scott Shawcroft
b4e1955526
Merge pull request #2583 from jepler/ulab
Add 'ulab' as an extmod; enable on nrf and most samd51 boards
2020-03-04 11:46:17 -08:00
Scott Shawcroft
4aec5d1e83
Merge pull request #2680 from hierophect/stm32-clock-hotfix
STM32: Fix restriction on GPIO clock enables for F407 Discovery board
2020-03-04 11:43:33 -08:00
Jeff Epler
da31acfcc4 Merge remote-tracking branch 'origin/master' into ulab 2020-03-03 20:13:53 -06:00
Dan Halbert
e98991fd7e
Merge pull request #2678 from adafruit/5.0.x
Merge in 5.0.x changes
2020-03-03 17:31:36 -05:00
Lucian Copeland
55e13715a9 Expand GPIO clock enables for F405 and F407 2020-03-03 17:21:47 -05:00
Scott Shawcroft
6468ca04a4
Merge pull request #2668 from hierophect/stm32-pulseout
STM32: Add PulseOut support
2020-03-03 13:11:24 -08:00
hierophect
3178462218
Merge branch 'master' into stm32-pulseout 2020-03-03 15:03:19 -05:00
Scott Shawcroft
2fea811c30
Merge pull request #2672 from jepler/fuzz
Makefiles: add targets to build unix port, mpy-cross for fuzzing
2020-03-03 11:36:53 -08:00
Scott Shawcroft
17458ad81a
Merge pull request #2662 from jepler/issue2332
Fix unaligned disk reads properly
2020-03-03 11:27:50 -08:00
Scott Shawcroft
274cb597b0
Remove debug extern 2020-03-03 10:55:50 -08:00
Jeff Epler
c0bfa11766 Use tests from ulab extmod, instead of our own 2020-03-03 12:46:59 -06:00
Scott Shawcroft
2e370008c3
Merge pull request #2670 from jepler/compile-assertion-errors
Turn certain assertion errors in mpy-cross into SyntaxErrors
2020-03-03 10:11:36 -08:00
Lucian Copeland
eb71bfe9d3 Exclude SoCs without basic timers 2020-03-02 11:22:40 -05:00
Jeff Epler
402262a843 make translate 2020-03-02 09:13:06 -06:00
Dan Halbert
ba0c14f9dd
Merge pull request #2671 from dhalbert/merge-for-5.0.0-rc.1
Merge for 5.0.0 rc.1
2020-03-01 15:39:26 -05:00
Jeff Epler
74bf17bb0d Makefiles: add targets to build unix port, mpy-cross for fuzzing
This assumes you have properly install afl-fuzz with afl-clang-fast.
Tested with AFLplusplus 2.60c-75-g2c6847b.
2020-03-01 11:48:33 -06:00
Dan Halbert
898f67ac2e Merge branch 'master' into merge-for-5.0.0-rc.1 2020-03-01 12:22:18 -05:00
Dan Halbert
7528814617
Merge pull request #2664 from dhalbert/downloads-from-s3
Download links from S3; Do not upload release assets to GitHub
2020-03-01 11:43:55 -05:00
Jeff Epler
862830da32 compile: Give a proper error on 'async with'/'async for' outside 'async def'
A simple reproducer is:
   async for x in():x
2020-03-01 09:40:43 -06:00
Jeff Epler
511c180869 parse: push_result_token: throw an exception on too-long names
Before this, such names would instead cause an assertion error inside
qstr_from_strn.

A simple reproducer is a python source file containing the letter "a"
repeated 256 times
2020-03-01 09:38:34 -06:00
Jeff Epler
dc64857a7d
Merge branch 'master' into ulab 2020-02-29 21:54:39 -06:00
Dan Halbert
e30b1d3121 missing semicolon 2020-02-29 22:48:11 -05:00
Dan Halbert
5bb23536b7 Merge branch 'assert_pin-and-mp_const_none-cleanup' of https://github.com/dhalbert/circuitpython into assert_pin-and-mp_const_none-cleanup 2020-02-29 15:57:35 -05:00
Dan Halbert
8435935429 update uses of assert_pin_free; remove redundant checks 2020-02-29 15:37:32 -05:00
Lucian Copeland
6bb1649b4b Add translations 2020-02-29 14:52:49 -05:00
Lucian Copeland
611ef27ac2 stm32: Add PulseOut support
Matches the implementations of the NRF and Atmel ports. TIM7 is used as it does not have a tied pin. Contains some register micromanagement since HAL support for the TIM7 timer is limited.
2020-02-29 14:47:47 -05:00
Dan Halbert
b6206406de new pin validation routines; don't use mp_const_none if NULL will do 2020-02-28 23:43:04 -05:00