Commit Graph

667 Commits

Author SHA1 Message Date
Jeff Epler c843122d3d fix doc build 2021-01-15 12:00:29 -06:00
Jeff Epler a98df7209d Update to 1.7.1 2021-01-15 09:50:58 -06:00
Jeff Epler ad87f37689 ulab: update to 1.7.0 2021-01-14 14:16:11 -06:00
Jeff Epler 0593e464bf ulab: bump to version 1.6.1 2021-01-11 13:52:46 -06:00
Jeff Epler 09bf58407f ulab: update to 1.6.0
This fixes several problems I encountered.
2021-01-04 12:50:08 -06:00
Jeff Epler 22af5a1fe9
Merge pull request #3728 from tannewt/speedup_json
Speed up JSON parsing with readinto
2020-11-24 09:42:18 -06:00
Scott Shawcroft f8dcb25170
Merge pull request #3694 from jepler/update-ulab2
ulab: Update to release tag 1.1.0
2020-11-23 15:17:46 -08:00
Scott Shawcroft 368fa88312
Ignore size parameter 2020-11-23 12:14:58 -08:00
Jeff Epler 9d8be648ee ulab: Update to release tag 1.1.0
Disable certain classes of diagnostic when building ulab.  We should
submit patches upstream to (A) fix these errors and (B) upgrade their
CI so that the problems are caught before we want to integrate with
CircuitPython, but not right now.
2020-11-23 10:23:50 -06:00
Scott Shawcroft 123210a989
Speed up JSON parsing with readinto
Get a chunk of data from readinto instead of a single byte. This
speeds up the parsing by reducing the number of function calls.

Fixes #3703
2020-11-19 17:13:24 -08:00
Jeff Epler c06fc8e02d Introduce, use mp_raise_arg1
This raises an exception with a given object value.  Saves a bit of
code size.
2020-11-19 16:15:06 -06:00
Jeff Epler d5f6748d1b Use mp_raise instead of nlr_raise(new_exception) where possible
This saves a bit of code space
2020-11-19 16:13:01 -06:00
Jeff Epler 543316a8fb ulab: Update again
.. pull in various doc build fixes that prevented the previous commit from building.  This is still "0.54.5", the tag was updated in micropython-ulab (since no functional difference was introduced, only doc and CI differences, I imagine)
2020-10-25 13:26:55 -05:00
Jeff Epler 4cad5478e6 ulab: Incorporate bugfixes (update to tag 0.54.5)
In particular, this closes #3954.
2020-10-24 13:16:10 -05:00
Scott Shawcroft 09bc415751
Unify iMX flash config and add Metro M7 1011
This unifies the flash config to the settings used by the Boot ROM.
This makes the config unique per board which allows for changing
quad enable and status bit differences per flash device. It also
allows for timing differences due to the board layout.

This change also tweaks linker layout to leave more ram space for
the CircuitPython heap.
2020-10-07 15:23:47 -07:00
Jeff Epler 12d826d941 Add FALLTHROUGH comments as needed
I investigated these cases and confirmed that the fallthrough behavior
was intentional.
2020-09-12 15:11:29 -05:00
Jeff Epler c849b781c0 Combine 'index out of range' messages 2020-08-04 14:45:45 -05:00
Jeff Epler 89797fd3f9 various: Use mp_obj_get_type_qstr more widely
This removes runtime allocations of the cstring version of the qstring.

It is not a size improvement
2020-08-04 14:45:45 -05:00
Jeff Epler 9b8df7f635 Upgrade ulab
This version
 * moves source files to reflect module structure
 * adds inline documentation suitable for extract_pyi
 * incompatibly moves spectrogram to fft
 * incompatibly removes "extras"

There are some remaining markup errors in the specific revision of
extmod/ulab but they do not prevent the doc building process from
completing.
2020-07-28 16:57:48 -05:00
Dan Halbert 88d8956378
Merge pull request #3143 from tannewt/improve_json
Add support to json.load for any object with readinto
2020-07-16 14:33:33 -04:00
Scott Shawcroft 372bcf8a95
Fix stream version and add basic readinto test 2020-07-10 17:33:17 -07:00
Scott Shawcroft 734661e79c
Add support to json.load for any object with readinto
This way we don't need to load the whole string version of the
json into memory.
2020-07-10 16:42:32 -07:00
Diego Elio Pettenò 34b4993d63 Add license to some obvious files. 2020-07-06 19:16:25 +01:00
Jeff Epler 783846c605 ulab: update to 0.51.1 2020-07-01 10:00:28 -05:00
Jeff Epler 103ad9966a remove machine_i2c, machine_spi
This micropython code is not used in circuitpython
2020-06-25 11:44:21 -05:00
Diego Elio Pettenò dd5d7c86d2 Fix up end of file and trailing whitespace.
This can be enforced by pre-commit, but correct it separately to make it easier to review.
2020-06-03 10:56:35 +01:00
Jeff Epler 7f3fd20ea9 ulab: update submodule again 2020-06-01 11:03:38 -05:00
Jeff Epler 18c659780e ulab: update
.. add new modules and functions to our shared-bindings stubs
2020-06-01 09:02:29 -05:00
warriorofwire d8491f3176 ujson: back out overeager loads() change; only change load() 2020-05-10 21:56:01 -07:00
warriorofwire eb3d5fa453 ujson: do not eat trailing whitespace
Ujson should only worry about whitespace before JSON.  This becomes apparent when you are using MP stream protocol to read directly from input buffers.

When you attempt to read(1) on a UART (and possibly other protocols) you have to wait for either the byte or the timeout.

Fixes:
- Waiting for a timeout after you have completed reading a correct and complete JSON off the input.
- Raising an OSError after reading a correct and complete JSON off the input.
- Eating more data than semantically owned off the input buffer.
- Blocking to start parsing JSON until the entire JSON body has been loaded into a potentially large, contiguous Python object.

Code you would write before:
```
line = board_busio_uart_port.read_line()
json_dict = json.loads(line)
```
or reaching for fixed buffers and swapping them around in Python.

Code that did not work before that does now:
```
json_dict = json.load(board_busio_uart_port)
```

- This removes the need for intermediate copies of data when reading JSON from micropython stream protocol inputs.
- It also increases total application speed by parsing JSON concurrently with receiving on boards that read from UART via DMA.
- It simplifies code that users write while improving their apps.
2020-05-10 20:45:42 -07:00
Jeff Epler 1a6df71cec ulab: update 2020-04-27 07:46:48 -05:00
Jeff Epler c016ea6f0a ulab: actually update the submodule
PR#2802 missed the submodule update itself.
2020-04-26 10:12:56 -05:00
Jeff Epler cc21bed0e4 ulab: Get updates from upstream 2020-04-14 10:09:00 -05:00
Jeff Epler ca97964701 ulab: Get updates from upstream 2020-04-13 19:00:16 -05:00
Jeff Epler 772ac705d3 update ulab 2020-03-17 08:32:52 -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 39cfe32c34 Update ulab from upstream again 2020-02-27 14:14:05 -06:00
Jeff Epler fa3b9eba92 ulab: Incorporate it 2020-02-27 11:03:03 -06:00
Dan Halbert e0753c4ad2 avoid os.stat() int overflow on smallint-only builds 2020-02-14 18:33:37 -05:00
Dan Halbert 5164719e67 preserve errno in OSError 2020-02-04 16:19:40 -05:00
Dan Halbert 57b566e736 Include filename for 'No such file/directory', etc. 2020-02-04 13:32:39 -05:00
Scott Shawcroft f6a635b102
Fix subclassing of objects that are tested. Others may still be broken. 2020-01-27 14:52:42 -08:00
Roy Hooper 767ce1cdf8 remove unnecessary GCC pragmas 2020-01-02 18:03:18 -05:00
Roy Hooper ccf158b030 raise mp_raise_NotImplementedError 2020-01-02 18:00:36 -05:00
Roy Hooper dc8dd6df20 Revert subscr signature change 2019-12-13 14:29:15 -05:00
Roy Hooper 15072c69c9 push changes 2019-12-13 14:07:53 -05:00
Roy Hooper 0326c98fd5 Merge branch 'master' into new-pixelbuf-api 2019-12-10 20:44:43 -05:00
Jeff Epler 238e121236 protocols: Allow them to be (optionally) type-safe
Protocols are nice, but there is no way for C code to verify whether
a type's "protocol" structure actually implements some particular
protocol.  As a result, you can pass an object that implements the
"vfs" protocol to one that expects the "stream" protocol, and the
opposite of awesomeness ensues.

This patch adds an OPTIONAL (but enabled by default) protocol identifier
as the first member of any protocol structure.  This identifier is
simply a unique QSTR chosen by the protocol designer and used by each
protocol implementer.  When checking for protocol support, instead of
just checking whether the object's type has a non-NULL protocol field,
use `mp_proto_get` which implements the protocol check when possible.

The existing protocols are now named:
    protocol_framebuf
    protocol_i2c
    protocol_pin
    protocol_stream
    protocol_spi
    protocol_vfs
(most of these are unused in CP and are just inherited from MP; vfs and
stream are definitely used though)

I did not find any crashing examples, but here's one to give a flavor of what
is improved, using `micropython_coverage`.  Before the change,
the vfs "ioctl" protocol is invoked, and the result is not intelligible
as json (but it could have resulted in a hard fault, potentially):

    >>> import uos, ujson
    >>> u = uos.VfsPosix('/tmp')
    >>> ujson.load(u)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ValueError: syntax error in JSON

After the change, the vfs object is correctly detected as not supporting
the stream protocol:
    >>> ujson.load(p)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    OSError: stream operation not supported
2019-12-04 09:29:57 -06:00
Roy Hooper 56720eae0a remove unnecessary intermediate mp_obj_subscr wrapper 2019-11-26 18:39:08 -05:00
Roy Hooper a9baa441c9 disable -Wunused-parameter on subscr functions 2019-11-23 13:52:14 -05:00