Commit Graph

5635 Commits

Author SHA1 Message Date
Scott Shawcroft
9633c4e78f
Merge remote-tracking branch 'adafruit/main' into v1.20-merge 2023-10-11 11:21:57 -07:00
Scott Shawcroft
6e278900bd
Only include mpconfigport.h once 2023-10-11 10:04:03 -07:00
Scott Shawcroft
9be3999e78
Add back makefile print variable 2023-10-11 10:04:02 -07:00
Scott Shawcroft
2910dea6fd
Almost fix extra_coverage test 2023-10-11 10:04:02 -07:00
Scott Shawcroft
22a44c6003
Try and fix mpy-cross variants 2023-10-11 10:03:46 -07:00
Dan Halbert
7869706551 force FROZEN_MANIFEST build; add back make print-% 2023-10-10 22:10:17 -04:00
Damien George
e00a144008 all: Bump version to 1.21.0.
Signed-off-by: Damien George <damien@micropython.org>
2023-10-06 10:32:07 +11:00
Scott Shawcroft
bf3d84195f
Fix decompressing using qstrs after running the VM
The qstr state still pointed to qstr pools in the released MP heap.
2023-10-05 14:56:11 -07:00
Scott Shawcroft
49511b0746
Bring back ordereddict.move_to_end() 2023-10-05 12:48:45 -07:00
Scott Shawcroft
94c7082e9c
Fix super init. CP changed it to support kwargs 2023-10-05 12:44:30 -07:00
Scott Shawcroft
18c03a74dd
Fix a few tests
* Re-enable a couple FATFS configurations we added.
* Remove MICROPY_PY_IO_FILEIO.
* Remove uasyncio from standard unix build.
* Re-add our unicode printing improvements.
2023-10-05 10:59:08 -07:00
Dan Halbert
7e0e6fcdca Metro M4 now compiles 2023-10-03 15:03:59 -04:00
Damien George
cf490a7091 all: Fix various spelling mistakes found by codespell 2.2.6.
Signed-off-by: Damien George <damien@micropython.org>
2023-10-03 11:24:50 +11:00
Jeff Epler
1b9ecabf8b
Fix constructing empty namedtuple
this change from micropython was not taken with the merge
2023-10-02 09:08:03 -05:00
Jeff Epler
18a5a897f1
makeqstrdef: restore CIRCUITPY behavior
this fixes the qrio test, among others
2023-10-02 08:50:47 -05:00
Jeff Epler
1ccce65311
file no longer used 2023-10-02 08:48:19 -05:00
Jeff Epler
6d59e55599
fix making mpy-cross automatically 2023-10-02 07:28:19 -05:00
Dan Halbert
2fc5a934a1 add back generic subscript iterator, gc_never_free 2023-09-29 23:01:02 -04:00
Dan Halbert
68a2927385 MP_REGISTER_ROOT_POINTER for port-specific root pointers 2023-09-29 15:46:42 -04:00
Dan Halbert
1c388ab315 finish converting to MP_REGISTER_ROOT_POINTER() 2023-09-29 10:49:34 -04:00
Jim Mussared
276bfa3146 py/lexer: Add missing initialisation for fstring_args_idx.
This was missed in 692d36d779. Probably
never noticed because everything enables `MICROPY_GC_CONSERVATIVE_CLEAR`,
but found via ASAN thanks to @gwangmu & @chibinz.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-09-29 13:58:26 +10:00
Ihor Nehrutsa
d83c1a43d4 py: Change ifdef DEBUG_PRINT to if DEBUG_PRINT.
Signed-off-by: Ihor Nehrutsa <Ihor.Nehrutsa@gmail.com>
2023-09-29 13:04:38 +10:00
Angus Gratton
2fcd28f713 py/mkrules.mk: Don't strip binary if STRIP variable is unset.
This provides a way to build a non-DEBUG host binary that still has symbols
and debug information.

Document this for the unix port, and update a comment in the unix port
Makefile.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-09-29 13:01:12 +10:00
Dan Halbert
76ff01452b Trinket M0 comes up; still very much wip 2023-09-28 16:22:10 -04:00
MicroDev
27fd60d739
implement suggested changes
- update the docs
- split out common `watchdog_reset`
- revert to using `None` instead of `WatchDogMode.NONE`
2023-09-24 15:23:38 +00:00
Jeff Epler
cd462c51b3
re-fix stream function definition 2023-09-22 14:26:36 -05:00
Jeff Epler
2c3d81148e
re-add CP-specific C files 2023-09-22 14:26:25 -05:00
Jeff Epler
c53cb3ef25
re-add CP-specific exception related types 2023-09-22 14:26:13 -05:00
Jeff Epler
79309c1208
re-add CP-specific exception types 2023-09-22 14:25:50 -05:00
Jeff Epler
4bbf42c4c3
fix duplicate array_locals_dict_table 2023-09-22 14:25:36 -05:00
Jeff Epler
7c2fbff965
fix use of locals_dict 2023-09-22 14:25:23 -05:00
Jeff Epler
99479a69f8
fix definition of slice type with optional "make_new" 2023-09-22 13:56:36 -05:00
Jeff Epler
e48984872b
allow definition of namedtuples in core 2023-09-22 13:56:16 -05:00
Jeff Epler
a181172336
remove redundant declaratoin 2023-09-22 13:55:24 -05:00
Jeff Epler
0265ae07f8
remove unused functions 2023-09-22 13:55:15 -05:00
Jeff Epler
51314fb7de
fix availability of mp_obj_array_locals_dict 2023-09-22 13:55:08 -05:00
Jeff Epler
2c70537aba
fix memoryview cast&hex 2023-09-22 13:54:20 -05:00
Jeff Epler
085cf0e3e4
make mp_stream_flush available 2023-09-22 13:52:04 -05:00
Jeff Epler
556ec9d300
fixes for mp_type_get_protocol_slot 2023-09-22 13:51:57 -05:00
Jeff Epler
566688b028
fix mpy magic numbers 2023-09-22 13:50:35 -05:00
Jeff Epler
bb0f8149df
fix circuitpy memoryview.cast 2023-09-22 13:44:48 -05:00
Jeff Epler
0d796249e8
remove unused function 2023-09-22 13:43:47 -05:00
Jeff Epler
5367c9f7ef
fix "native exception getter" 2023-09-22 13:42:19 -05:00
Jeff Epler
f9f75d8202
MAKE_ENUM_TYPE for new style type defs 2023-09-22 13:39:24 -05:00
Scott Shawcroft
7bad82a219
C6 compiles, runs but wifi crashes 2023-09-22 10:02:35 -07:00
Jeff Epler
6b5c7b6ce6
fix const vs static generatorexit again 2023-09-22 10:45:49 -05:00
Jeff Epler
9dda69cf9e
add missing declarations that got lost in the merge 2023-09-22 10:40:11 -05:00
Jeff Epler
f77e0b8992
fix comment marker 2023-09-22 10:39:50 -05:00
Jeff Epler
60fa26022b
build fixes for persistent code 2023-09-22 10:39:41 -05:00
Jeff Epler
5c0f8f7786
fixes for circuitpython nativeglue 2023-09-22 10:39:28 -05:00
Jeff Epler
a285a33076
Restore our defines for exception chaining 2023-09-22 10:39:12 -05:00
Jeff Epler
9104654930
makeqstrdata: ensure _lt and _gt qstrs are sorted early
this fixes a build error because their numbers have to be <256
2023-09-22 10:38:52 -05:00
Dan Halbert
10b95a1998 add translate.h and linker.h includes back to runtime.h; remove linker.h refs; remove top-level lib/cyw43-driver 2023-09-20 22:00:09 -04:00
Jeff Epler
a00f2d8940
array extend/append need extern linkage & right names 2023-09-20 11:46:51 -05:00
Jeff Epler
7a386545ca
re-add translation make rules 2023-09-20 11:46:35 -05:00
Jeff Epler
a760794449
re-add objtraceback.o 2023-09-20 11:46:22 -05:00
Jeff Epler
f83a235c85
re-add mp_obj_exception_get_native 2023-09-20 11:46:14 -05:00
Jeff Epler
76ef77a620
fix exception chaining, preprocessor error 2023-09-20 11:26:57 -05:00
Jeff Epler
e068ff7234
fix compile errors, fix mp_raise prototypes 2023-09-20 11:26:41 -05:00
Jeff Epler
1ab884ab0f
fix compile errors 2023-09-20 11:26:26 -05:00
Jeff Epler
c87703512a
fix conditional nesting 2023-09-20 11:26:17 -05:00
Jeff Epler
37c8b0df9c
fix argument name 2023-09-20 11:26:03 -05:00
Jeff Epler
6b8ee2ca6f
remove old python style checking for "special accessors"
this appears to be properly handled by other (new?) code, but
tests will tell.
2023-09-20 11:25:58 -05:00
Jeff Epler
bb6d530c1d
slots & macro moved to header 2023-09-20 11:25:09 -05:00
Jeff Epler
7806044e5e
string construction changed 2023-09-20 11:25:01 -05:00
Jeff Epler
9cedfc4cbd
implemented as macro now 2023-09-20 11:24:53 -05:00
Jeff Epler
ee51968d9d
can't be static, is called from builtins 2023-09-20 11:24:45 -05:00
Jeff Epler
4ed939f26e
fix compile error 2023-09-20 11:24:26 -05:00
Jeff Epler
680b94d463
fix compile erors 2023-09-20 11:24:22 -05:00
Jeff Epler
be62395c47
fix indentation 2023-09-20 11:24:15 -05:00
Jeff Epler
f9fb567a07
fix CP vs MP differences in exception-throwing functions 2023-09-20 11:24:07 -05:00
Jeff Epler
37a881f4d3
Get the type object for the constructor call 2023-09-20 11:23:49 -05:00
Jeff Epler
082b299a0c
spelling 2023-09-20 11:23:39 -05:00
Jeff Epler
8e00c69cdf
spelling 2023-09-20 11:22:34 -05:00
Jeff Epler
cd3ca6b6a6
fix array object name 2023-09-20 11:22:25 -05:00
Jeff Epler
fb2eb6a7d9
add mp_obj_is_tuple_compatible 2023-09-20 11:22:01 -05:00
Jeff Epler
e4e58ac223
add mp_obj_get_type_qstr 2023-09-20 11:21:56 -05:00
Jeff Epler
a9d6661d5b
add and fix exception prototypes 2023-09-20 11:21:50 -05:00
Jeff Epler
b499b7fdc2
add missing type objects 2023-09-20 11:21:34 -05:00
Jeff Epler
57c3dfd579
fix missing define of NONSTANDARD_TYPECODES 2023-09-20 11:21:10 -05:00
Jeff Epler
649ea62f57
fix typo 2023-09-20 11:21:02 -05:00
Jeff Epler
73612ac119
Fix availability of MP_ERROR_TEXT in misc.h 2023-09-20 11:20:56 -05:00
Jeff Epler
aceb573c88
fix makeversionhdr 2023-09-20 11:20:45 -05:00
Jeff Epler
dc277f0aff
fix HEAP_PTR macro 2023-09-20 11:20:39 -05:00
Jeff Epler
36371fe757
fix compiling gc.c 2023-09-20 11:20:29 -05:00
Jeff Epler
0c64275cc6
Add header for PLACE_IN_ITCM 2023-09-20 11:19:57 -05:00
Angus Gratton
fa68523968 py/nlrx64: Mark nlr_push() as naked function when possible.
Supported from GCC 8 and up, and Compiler Explorer suggests it works as
expected with Clang since 3.6 (2014).

- Fixes situation where building embedded MicroPython with -O0 and
  MICROPY_NLR_X64 crashes at runtime (due to nlr_push pushing the
  frame pointer register EBP). Closes #12421.

- Allows removing the macOS tweak to undo pushing EBP onto the stack
  in the generated function prelude.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-09-20 11:48:36 +10:00
Dan Halbert
4d175ab41a convert to MP_DEFINED_CONST_OBJ_TYPE() 2023-09-19 21:09:29 -04:00
Dan Halbert
2c0fa0f7dc initial merge from v1.20.0; just satisifying conflicts 2023-09-19 11:10:12 -04:00
Jeff Epler
a8b81ce943
Enhance unexpected keyword argument detection
Before, incorrect use when calling a core function would just say
"extra keyword arguments given"; now, it will name the argument:

```python
>>> Synthesizer(bad_kwarg="boo")
TypeError: unexpected keyword argument 'bad_kwarg'
```
2023-09-15 10:39:14 -05:00
Angus Gratton
3e8aed9fcc py/gc: Add "max new split" value in result of gc.mem_free().
Follow-up to 519c24dd48 when MICROPY_GC_SPLIT_HEAP_AUTO is enabled, based
on discussion at
https://github.com/orgs/micropython/discussions/12316#discussioncomment-6858007

gc.mem_free() is always a heuristic, but this makes it a more useful
heuristic for common use cases.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-09-15 12:19:13 +10:00
Jeff Epler
4b41fdb586
Fast(ish) special purpose bitbang spi over i2c
with the i2c bus operating at 400kHz this achieves a 4.8kHz SPI clock
rate which could be worse.

It accepts the same style of init sequence as displayio.

tested by scoping the pins on the espressif lcd dev kit with a dummy init sequence:
```python
dotclockframebuffer.ioexpander_send_init_sequence(
    bus=bus,
    i2c_address=expander_addr,
    gpio_address=1,
    gpio_data_len=1,
    gpio_data=0xff,
    cs_bit=1,
    mosi_bit=3,
    clk_bit=2,
    init_sequence=init_sequence)
```
2023-09-14 14:42:48 -05:00
Damien George
397697aa83 py/persistentcode: Always close reader even if an exception is raised.
Fixes issue #3874.

Signed-off-by: Damien George <damien@micropython.org>
2023-09-14 13:03:31 +10:00
Damien George
5e122b11ea py/parse: Always free lexer even if an exception is raised.
Fixes issue #3843.

Signed-off-by: Damien George <damien@micropython.org>
2023-09-14 13:03:31 +10:00
Damien George
c9089e71a1 py/runtime: Add helpers to call a general function on nlr jump callback.
Signed-off-by: Damien George <damien@micropython.org>
2023-09-14 13:03:31 +10:00
Scott Shawcroft
0928a95bb2
Merge pull request #8351 from jepler/dotclockframebuffer
Dotclockframebuffer
2023-09-07 13:21:29 -07:00
IhorNehrutsa
6e79b55dc8 py/malloc: Fix DEBUG_print() args in m_realloc_maybe.
Signed-off-by: Ihor Nehrutsa <IhorNehrutsa@gmail.com>
2023-09-04 10:26:09 +10:00
David Lechner
ffb43b2dd3 py/modthread: Return thread id from start_new_thread().
In CPython, `_thread.start_new_thread()` returns an ID that is the same ID
that is returned by `_thread.get_ident()`.  The current MicroPython
implementation of `_thread.start_new_thread()` always returns `None`.

This modifies the required functions to return a value. The native thread
id is returned since this can be used for interop with other functions, for
example, `pthread_kill()` on *nix. `_thread.get_ident()` is also modified
to return the native thread id so that the values match and avoids the need
for a separate `native_id` attribute.

Fixes issue #12153.

Signed-off-by: David Lechner <david@pybricks.com>
2023-09-03 18:49:18 +10:00
Jim Mussared
a64f2fdca0 py/dynruntime.h: Implement MP_OBJ_NEW_QSTR.
Because mpy_ld.py doesn't know the target object representation, it emits
instances of `MP_OBJ_NEW_QSTR(MP_QSTR_Foo)` as const string objects, rather
than qstrs. However this doesn't work for map keys (e.g. for a locals dict)
because the map has all_keys_are_qstrs flag is set (and also auto-complete
requires the map keys to be qstrs).

Instead, emit them as regular qstrs, and make a functioning MP_OBJ_NEW_QSTR
function available (via `native_to_obj`, also used for e.g. making
integers).

Remove the code from mpy_ld.py to emit qstrs as constant strings, but leave
behind the scaffold to emit constant objects in case we want to do use this
in the future.

Strictly this should be a .mpy sub-version bump, even though the function
table isn't changing, it does lead to a change in behavior for a new .mpy
running against old MicroPython. `mp_native_to_obj` will incorrectly return
the qstr value directly as an `mp_obj_t`, leading to unexpected results.
But given that it's broken at the moment, it seems unlikely that anyone is
relying on this, so it's not work the other downsides of a sub-version bump
(i.e. breaking pure-Python modules that use @native). The opposite case of
running an old .mpy on new MicroPython is unchanged, and remains broken in
exactly the same way.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-09-01 16:14:22 +10:00
Daniël van de Giessen
d1f288c041 py/modstruct: Support pad bytes in struct format.
This adds support for the x format code in struct.pack and struct.unpack.

The primary use case for this is ignoring bytes while unpacking.  When
interfacing with existing systems, it may often happen that you either have
fields in a struct that aren't properly specified or you simply don't care
about them.  Being able to easily skip them is useful.

Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2023-09-01 14:50:49 +10:00