Skip to content

Commit 4c9d14b

Browse files
committed
Merge remote-tracking branch 'origin/main' into merge-1.18
2 parents 3e338c4 + 3a0892d commit 4c9d14b

51 files changed

Lines changed: 493 additions & 145 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ jobs:
4242
run: python tools/ci_fetch_deps.py test ${{ github.sha }}
4343
- name: CircuitPython version
4444
run: |
45-
git describe --dirty --tags || git log --parents HEAD~4..
46-
echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags)
45+
tools/describe || git log --parents HEAD~4..
46+
echo >>$GITHUB_ENV CP_VERSION=$(tools/describe)
4747
- name: Install dependencies
4848
run: |
4949
sudo apt-get update
@@ -77,6 +77,19 @@ jobs:
7777
- name: Native mpy Tests
7878
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1 --mpy-cross-flags='-mcache-lookup-bc' --via-mpy --emit native -d basics float micropython
7979
working-directory: tests
80+
- name: Build native modules
81+
run: |
82+
make -C examples/natmod/features1
83+
make -C examples/natmod/features2
84+
make -C examples/natmod/btree
85+
make -C examples/natmod/framebuf
86+
make -C examples/natmod/uheapq
87+
make -C examples/natmod/urandom
88+
make -C examples/natmod/ure
89+
make -C examples/natmod/uzlib
90+
- name: Test native modules
91+
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-natmodtests.py extmod/{btree*,framebuf*,uheapq*,ure*,uzlib*}.py
92+
working-directory: tests
8093
- name: Build mpy-cross.static-aarch64
8194
run: make -C mpy-cross -j2 -f Makefile.static-aarch64
8295
- uses: actions/upload-artifact@v2
@@ -148,8 +161,8 @@ jobs:
148161
run: python tools/ci_fetch_deps.py mpy-cross-mac ${{ github.sha }}
149162
- name: CircuitPython version
150163
run: |
151-
git describe --dirty --tags
152-
echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags)
164+
tools/describe || git log --parents HEAD~4..
165+
echo >>$GITHUB_ENV CP_VERSION=$(tools/describe)
153166
- name: Install dependencies
154167
run: |
155168
brew install gettext
@@ -204,8 +217,8 @@ jobs:
204217
run: python tools/ci_fetch_deps.py docs ${{ github.sha }}
205218
- name: CircuitPython version
206219
run: |
207-
git describe --dirty --tags
208-
echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags)
220+
tools/describe || git log --parents HEAD~4..
221+
echo >>$GITHUB_ENV CP_VERSION=$(tools/describe)
209222
- name: Set up Python 3
210223
uses: actions/setup-python@v2
211224
with:
@@ -379,7 +392,9 @@ jobs:
379392
- name: Get CP deps
380393
run: python tools/ci_fetch_deps.py ${{ matrix.board }} ${{ github.sha }}
381394
- name: CircuitPython version
382-
run: git describe --dirty --tags
395+
run: |
396+
tools/describe || git log --parents HEAD~4..
397+
echo >>$GITHUB_ENV CP_VERSION=$(tools/describe)
383398
- uses: actions/cache@v2
384399
name: Fetch IDF tool cache
385400
id: idf-cache

.github/workflows/create_website_pr.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ jobs:
3434
gcc --version
3535
python3 --version
3636
- name: CircuitPython version
37-
run: git describe --dirty --tags
37+
run: |
38+
tools/describe || git log --parents HEAD~4..
39+
echo >>$GITHUB_ENV CP_VERSION=$(tools/describe)
3840
- name: Website
3941
run: python3 build_board_info.py
4042
working-directory: tools

.github/workflows/ports_windows.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ jobs:
7777
run: python tools/ci_fetch_deps.py windows ${{ github.sha }}
7878
- name: CircuitPython version
7979
run: |
80-
git describe --dirty --tags
81-
echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags)
80+
tools/describe || git log --parents HEAD~4..
81+
echo >>$GITHUB_ENV CP_VERSION=$(tools/describe)
8282
8383
- name: build mpy-cross
8484
run: make -j2 -C mpy-cross

conf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@
2424
import sys
2525
import urllib.parse
2626
import time
27+
import pathlib
2728
from collections import defaultdict
2829

2930
from sphinx.transforms import SphinxTransform
3031
from docutils import nodes
3132
from sphinx import addnodes
3233

34+
tools_describe = str(pathlib.Path(__file__).parent / "tools/describe")
35+
3336
# If extensions (or modules to document with autodoc) are in another directory,
3437
# add these directories to sys.path here. If the directory is relative to the
3538
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -129,7 +132,7 @@ def autoapi_prepare_jinja_env(jinja_env):
129132

130133
final_version = ""
131134
git_describe = subprocess.run(
132-
["git", "describe", "--dirty", "--tags"],
135+
[tools_describe],
133136
stdout=subprocess.PIPE,
134137
stderr=subprocess.STDOUT,
135138
encoding="utf-8"

examples/natmod/btree/btree_c.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ void *memmove(void *dest, const void *src, size_t n) {
1818
}
1919

2020
void *malloc(size_t n) {
21-
void *ptr = m_malloc(n);
21+
void *ptr = m_malloc(n, false);
2222
return ptr;
2323
}
2424
void *realloc(void *ptr, size_t n) {
2525
mp_printf(&mp_plat_print, "UNDEF %d\n", __LINE__);
2626
return NULL;
2727
}
2828
void *calloc(size_t n, size_t m) {
29-
void *ptr = m_malloc(n * m);
29+
void *ptr = m_malloc(n * m, false);
3030
// memory already cleared by conservative GC
3131
return ptr;
3232
}
@@ -51,7 +51,7 @@ int *__errno (void)
5151

5252
ssize_t mp_stream_posix_write(void *stream, const void *buf, size_t len) {
5353
mp_obj_base_t* o = stream;
54-
const mp_stream_p_t *stream_p = o->type->protocol;
54+
const mp_stream_p_t *stream_p = o->type->ext[0].protocol;
5555
mp_uint_t out_sz = stream_p->write(MP_OBJ_FROM_PTR(stream), buf, len, &native_errno);
5656
if (out_sz == MP_STREAM_ERROR) {
5757
return -1;
@@ -62,7 +62,7 @@ ssize_t mp_stream_posix_write(void *stream, const void *buf, size_t len) {
6262

6363
ssize_t mp_stream_posix_read(void *stream, void *buf, size_t len) {
6464
mp_obj_base_t* o = stream;
65-
const mp_stream_p_t *stream_p = o->type->protocol;
65+
const mp_stream_p_t *stream_p = o->type->ext[0].protocol;
6666
mp_uint_t out_sz = stream_p->read(MP_OBJ_FROM_PTR(stream), buf, len, &native_errno);
6767
if (out_sz == MP_STREAM_ERROR) {
6868
return -1;
@@ -73,7 +73,7 @@ ssize_t mp_stream_posix_read(void *stream, void *buf, size_t len) {
7373

7474
off_t mp_stream_posix_lseek(void *stream, off_t offset, int whence) {
7575
const mp_obj_base_t* o = stream;
76-
const mp_stream_p_t *stream_p = o->type->protocol;
76+
const mp_stream_p_t *stream_p = o->type->ext[0].protocol;
7777
struct mp_stream_seek_t seek_s;
7878
seek_s.offset = offset;
7979
seek_s.whence = whence;
@@ -86,15 +86,15 @@ off_t mp_stream_posix_lseek(void *stream, off_t offset, int whence) {
8686

8787
int mp_stream_posix_fsync(void *stream) {
8888
mp_obj_base_t* o = stream;
89-
const mp_stream_p_t *stream_p = o->type->protocol;
89+
const mp_stream_p_t *stream_p = o->type->ext[0].protocol;
9090
mp_uint_t res = stream_p->ioctl(MP_OBJ_FROM_PTR(stream), MP_STREAM_FLUSH, 0, &native_errno);
9191
if (res == MP_STREAM_ERROR) {
9292
return -1;
9393
}
9494
return res;
9595
}
9696

97-
mp_obj_type_t btree_type;
97+
mp_obj_full_type_t btree_type;
9898

9999
#include "extmod/modbtree.c"
100100

@@ -123,12 +123,13 @@ mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *a
123123
MP_DYNRUNTIME_INIT_ENTRY
124124

125125
btree_type.base.type = (void*)&mp_fun_table.type_type;
126+
btree_type.flags = MP_TYPE_FLAG_EXTENDED;
126127
btree_type.name = MP_QSTR_btree;
127128
btree_type.print = btree_print;
128-
btree_type.getiter = btree_getiter;
129-
btree_type.iternext = btree_iternext;
130-
btree_type.binary_op = btree_binary_op;
131-
btree_type.subscr = btree_subscr;
129+
btree_type.ext[0].getiter = btree_getiter;
130+
btree_type.ext[0].iternext = btree_iternext;
131+
btree_type.ext[0].binary_op = btree_binary_op;
132+
btree_type.ext[0].subscr = btree_subscr;
132133
btree_locals_dict_table[0] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_close), MP_OBJ_FROM_PTR(&btree_close_obj) };
133134
btree_locals_dict_table[1] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_flush), MP_OBJ_FROM_PTR(&btree_flush_obj) };
134135
btree_locals_dict_table[2] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_get), MP_OBJ_FROM_PTR(&btree_get_obj) };

examples/natmod/framebuf/framebuf.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ void *memset(void *s, int c, size_t n) {
88
}
99
#endif
1010

11-
mp_obj_type_t mp_type_framebuf;
11+
mp_obj_full_type_t mp_type_framebuf;
1212

1313
#include "extmod/modframebuf.c"
1414

@@ -19,9 +19,10 @@ mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *a
1919
MP_DYNRUNTIME_INIT_ENTRY
2020

2121
mp_type_framebuf.base.type = (void*)&mp_type_type;
22+
mp_type_framebuf.flags = MP_TYPE_FLAG_EXTENDED;
2223
mp_type_framebuf.name = MP_QSTR_FrameBuffer;
2324
mp_type_framebuf.make_new = framebuf_make_new;
24-
mp_type_framebuf.buffer_p.get_buffer = framebuf_get_buffer;
25+
mp_type_framebuf.ext[0].buffer_p.get_buffer = framebuf_get_buffer;
2526
framebuf_locals_dict_table[0] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_fill), MP_OBJ_FROM_PTR(&framebuf_fill_obj) };
2627
framebuf_locals_dict_table[1] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_fill_rect), MP_OBJ_FROM_PTR(&framebuf_fill_rect_obj) };
2728
framebuf_locals_dict_table[2] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_pixel), MP_OBJ_FROM_PTR(&framebuf_pixel_obj) };

examples/natmod/uzlib/uzlib.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ void *memset(void *s, int c, size_t n) {
88
}
99
#endif
1010

11-
mp_obj_type_t decompio_type;
11+
mp_obj_full_type_t decompio_type;
12+
mp_stream_p_t decompio_stream_p;
1213

1314
#include "extmod/moduzlib.c"
1415

@@ -18,10 +19,14 @@ STATIC MP_DEFINE_CONST_DICT(decompio_locals_dict, decompio_locals_dict_table);
1819
mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) {
1920
MP_DYNRUNTIME_INIT_ENTRY
2021

22+
decompio_stream_p.name = MP_QSTR_protocol_stream;
23+
decompio_stream_p.read = decompio_read;
24+
2125
decompio_type.base.type = mp_fun_table.type_type;
26+
decompio_type.flags = MP_TYPE_FLAG_EXTENDED;
2227
decompio_type.name = MP_QSTR_DecompIO;
2328
decompio_type.make_new = decompio_make_new;
24-
decompio_type.protocol = &decompio_stream_p;
29+
decompio_type.ext[0].protocol = &decompio_stream_p;
2530
decompio_locals_dict_table[0] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_read), MP_OBJ_FROM_PTR(&mp_stream_read_obj) };
2631
decompio_locals_dict_table[1] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_readinto), MP_OBJ_FROM_PTR(&mp_stream_readinto_obj) };
2732
decompio_locals_dict_table[2] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_readline), MP_OBJ_FROM_PTR(&mp_stream_unbuffered_readline_obj) };

extmod/modbtree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void __dbpanic(DB *db) {
4747

4848
STATIC mp_obj_btree_t *btree_new(DB *db, mp_obj_t stream) {
4949
mp_obj_btree_t *o = m_new_obj(mp_obj_btree_t);
50-
o->base.type = &btree_type;
50+
o->base.type = (mp_obj_type_t *)&btree_type;
5151
o->stream = stream;
5252
o->db = db;
5353
o->start_key = mp_const_none;

extmod/modframebuf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ STATIC const mp_obj_type_t mp_type_framebuf = {
622622
// this factory function is provided for backwards compatibility with old FrameBuffer1 class
623623
STATIC mp_obj_t legacy_framebuffer1(size_t n_args, const mp_obj_t *args) {
624624
mp_obj_framebuf_t *o = m_new_obj(mp_obj_framebuf_t);
625-
o->base.type = &mp_type_framebuf;
625+
o->base.type = (mp_obj_type_t *)&mp_type_framebuf;
626626

627627
mp_buffer_info_t bufinfo;
628628
mp_get_buffer_raise(args[0], &bufinfo, MP_BUFFER_WRITE);

extmod/moduzlib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,12 @@ STATIC const mp_rom_map_elem_t decompio_locals_dict_table[] = {
114114
STATIC MP_DEFINE_CONST_DICT(decompio_locals_dict, decompio_locals_dict_table);
115115
#endif
116116

117+
#if !MICROPY_ENABLE_DYNRUNTIME
117118
STATIC const mp_stream_p_t decompio_stream_p = {
118119
MP_PROTO_IMPLEMENT(MP_QSTR_protocol_stream)
119120
.read = decompio_read,
120121
};
121122

122-
#if !MICROPY_ENABLE_DYNRUNTIME
123123
STATIC const mp_obj_type_t decompio_type = {
124124
{ &mp_type_type },
125125
.flags = MP_TYPE_FLAG_EXTENDED,

0 commit comments

Comments
 (0)