Commit Graph

15721 Commits

Author SHA1 Message Date
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
Dan Halbert
ce9a7d7e2a new pin validation routines; don't use mp_const_none if NULL will do 2020-02-28 23:32:24 -05:00
Dan Halbert
98a03fc935 upload bin and uf2 for arduino boards; remove unneeded build steps 2020-02-28 21:18:48 -05:00
Dan Halbert
29e44721d2
Merge pull request #2665 from arturo182/esp32_freeze
Freeze adafruit_requests and adafruit_esp32spi into mimxrt1011 Feathers
2020-02-28 21:05:19 -05:00
arturo182
0af00cf914 Freeze adafruit_requests and adafruit_esp32spi into feather_m7_1011 2020-02-29 00:39:22 +01:00
arturo182
3f26a0b06b Freeze adafruit_requests and adafruit_esp32spi into feather_mimxrt1011 2020-02-29 00:26:39 +01:00
Dan Halbert
c24a4f7d66 change download prefix to https://downloads.circuitpython.org 2020-02-28 16:25:12 -05:00
Dan Halbert
1b8a4791f5 Download links now point to S3 via CloudFront 2020-02-28 14:57:32 -05:00
Jeff Epler
eef742bf45 oofatfs: Remove _FS_DISK_READ_ALIGNED
This workaround is no longer needed, so it can be removed.

Closes: #2332
2020-02-28 10:04:28 -06:00