Skip to content

Commit 35ffb64

Browse files
tannewtdhalbert
andcommitted
Apply suggestions from code review
Co-authored-by: Dan Halbert <[email protected]>
1 parent c352e73 commit 35ffb64

File tree

22 files changed

+67
-0
lines changed

22 files changed

+67
-0
lines changed

ports/unix/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ typedef long mp_off_t;
112112

113113
// Always enable GC.
114114
#define MICROPY_ENABLE_GC (1)
115+
// CIRCUITPY-CHANGE
115116
#define MICROPY_ENABLE_SELECTIVE_COLLECT (1)
116117

117118
#if !(defined(MICROPY_GCREGS_SETJMP) || defined(__x86_64__) || defined(__i386__) || defined(__thumb2__) || defined(__thumb__) || defined(__arm__))

py/bc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,15 @@ static inline void mp_module_context_alloc_tables(mp_module_context_t *context,
302302
#if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE
303303
size_t nq = (n_qstr * sizeof(qstr_short_t) + sizeof(mp_uint_t) - 1) / sizeof(mp_uint_t);
304304
size_t no = n_obj;
305+
// CIRCUITPY-CHANGE
305306
mp_uint_t *mem = m_malloc_items(nq + no);
306307
context->constants.qstr_table = (qstr_short_t *)mem;
307308
context->constants.obj_table = (mp_obj_t *)(mem + nq);
308309
#else
309310
if (n_obj == 0) {
310311
context->constants.obj_table = NULL;
311312
} else {
313+
// CIRCUITPY-CHANGE
312314
context->constants.obj_table = m_malloc_items(n_obj);
313315
}
314316
#endif

py/compile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3689,6 +3689,7 @@ void mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr source_file, bool
36893689

36903690
mp_obj_t mp_compile(mp_parse_tree_t *parse_tree, qstr source_file, bool is_repl) {
36913691
mp_compiled_module_t cm;
3692+
// CIRCUITPY-CHANGE
36923693
cm.context = m_malloc_with_collect(sizeof(mp_module_context_t));
36933694
cm.context->module.globals = mp_globals_get();
36943695
mp_compile_to_raw_code(parse_tree, source_file, is_repl, &cm);

py/emitbc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ struct _emit_t {
7676
};
7777

7878
emit_t *emit_bc_new(mp_emit_common_t *emit_common) {
79+
// CIRCUITPY-CHANGE
7980
emit_t *emit = m_new_struct_with_collect(emit_t, 1);
8081
emit->emit_common = emit_common;
8182
return emit;

py/gc.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,9 @@ static size_t compute_heap_size(size_t total_blocks) {
331331
static bool gc_try_add_heap(size_t failed_alloc) {
332332
// 'needed' is the size of a heap large enough to hold failed_alloc, with
333333
// the additional metadata overheads as calculated in gc_setup_area().
334+
// CIRCUITPY-CHANGE: calculation of how much to grow the heap
334335
size_t total_new_blocks = (failed_alloc + BYTES_PER_BLOCK - 1) / BYTES_PER_BLOCK;
336+
// CIRCUITPY-CHANGE
335337
size_t needed = compute_heap_size(total_new_blocks);
336338

337339
size_t avail = gc_get_max_new_split();
@@ -376,6 +378,7 @@ static bool gc_try_add_heap(size_t failed_alloc) {
376378
total_blocks += area->gc_alloc_table_byte_len * BLOCKS_PER_ATB;
377379
}
378380

381+
// CIRCUITPY-CHANGE
379382
size_t total_heap = compute_heap_size(total_blocks);
380383

381384
DEBUG_printf("total_heap " UINT_FMT " bytes\n", total_heap);
@@ -498,6 +501,7 @@ static void MP_NO_INSTRUMENT PLACE_IN_ITCM(gc_mark_subtree)(size_t block)
498501
// check that the consecutive blocks didn't overflow past the end of the area
499502
assert(area->gc_pool_start + (block + n_blocks) * BYTES_PER_BLOCK <= area->gc_pool_end);
500503

504+
// CIRCUITPY-CHANGE
501505
// check if this block should be collected
502506
#if MICROPY_ENABLE_SELECTIVE_COLLECT
503507
bool should_scan = CTB_GET(area, block);
@@ -1005,6 +1009,7 @@ void *gc_alloc(size_t n_bytes, unsigned int alloc_flags) {
10051009
(void)has_finaliser;
10061010
#endif
10071011

1012+
// CIRCUITPY-CHANGE
10081013
#if MICROPY_ENABLE_SELECTIVE_COLLECT
10091014
bool do_not_collect = (alloc_flags & GC_ALLOC_FLAG_DO_NOT_COLLECT) != 0;
10101015
GC_ENTER();
@@ -1184,6 +1189,7 @@ void *gc_realloc(void *ptr, mp_uint_t n_bytes) {
11841189
void *gc_realloc(void *ptr_in, size_t n_bytes, bool allow_move) {
11851190
// check for pure allocation
11861191
if (ptr_in == NULL) {
1192+
// CIRCUITPY-CHANGE
11871193
return gc_alloc(n_bytes, 0);
11881194
}
11891195

@@ -1329,6 +1335,7 @@ void *gc_realloc(void *ptr_in, size_t n_bytes, bool allow_move) {
13291335
}
13301336
#endif
13311337

1338+
// CIRCUITPY-CHANGE
13321339
#if MICROPY_ENABLE_SELECTIVE_COLLECT
13331340
if (!CTB_GET(area, block)) {
13341341
alloc_flags |= GC_ALLOC_FLAG_DO_NOT_COLLECT;
@@ -1343,6 +1350,7 @@ void *gc_realloc(void *ptr_in, size_t n_bytes, bool allow_move) {
13431350
}
13441351

13451352
// can't resize inplace; try to find a new contiguous chain
1353+
// CIRCUITPY-CHANGE
13461354
void *ptr_out = gc_alloc(n_bytes, alloc_flags);
13471355

13481356
// check that the alloc succeeded

py/gc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ void gc_sweep_all(void);
7373

7474
enum {
7575
GC_ALLOC_FLAG_HAS_FINALISER = 1,
76+
// CIRCUITPY-CHANGE
7677
#if MICROPY_ENABLE_SELECTIVE_COLLECT
7778
GC_ALLOC_FLAG_DO_NOT_COLLECT = 2,
7879
#endif

py/lexer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,7 @@ void mp_lexer_to_next(mp_lexer_t *lex) {
840840
}
841841

842842
mp_lexer_t *mp_lexer_new(qstr src_name, mp_reader_t reader) {
843+
// CIRCUITPY-CHANGE
843844
mp_lexer_t *lex = m_new_struct_with_collect(mp_lexer_t, 1);
844845

845846
lex->source_name = src_name;

py/malloc.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ void *m_malloc_helper(size_t num_bytes, uint8_t flags) {
119119
MP_STATE_MEM(current_bytes_allocated) += num_bytes;
120120
UPDATE_PEAK();
121121
#endif
122+
// CIRCUITPY-CHANGE
122123
// If this config is set then the GC clears all memory, so we don't need to.
123124
#if !MICROPY_GC_CONSERVATIVE_CLEAR
124125
if (flags & M_MALLOC_ENSURE_ZEROED) {
@@ -130,10 +131,12 @@ void *m_malloc_helper(size_t num_bytes, uint8_t flags) {
130131
}
131132

132133
void *m_malloc(size_t num_bytes) {
134+
// CIRCUITPY-CHANGE
133135
return m_malloc_helper(num_bytes, M_MALLOC_RAISE_ERROR);
134136
}
135137

136138
void *m_malloc_maybe(size_t num_bytes) {
139+
// CIRCUITPY-CHANGE
137140
return m_malloc_helper(num_bytes, 0);
138141
}
139142

@@ -142,10 +145,12 @@ void *m_malloc0(size_t num_bytes) {
142145
}
143146

144147
void *m_malloc_with_collect(size_t num_bytes) {
148+
// CIRCUITPY-CHANGE
145149
return m_malloc_helper(num_bytes, M_MALLOC_RAISE_ERROR | M_MALLOC_COLLECT);
146150
}
147151

148152
void *m_malloc_maybe_with_collect(size_t num_bytes) {
153+
// CIRCUITPY-CHANGE
149154
return m_malloc_helper(num_bytes, M_MALLOC_COLLECT);
150155
}
151156

py/map.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ void mp_map_init(mp_map_t *map, size_t n) {
9595
map->table = NULL;
9696
} else {
9797
map->alloc = n;
98+
// CIRCUITPY-CHANGE
9899
map->table = malloc_table(map->alloc);
99100
}
100101
map->used = 0;
@@ -136,6 +137,7 @@ static void mp_map_rehash(mp_map_t *map) {
136137
size_t new_alloc = get_hash_alloc_greater_or_equal_to(map->alloc + 1);
137138
DEBUG_printf("mp_map_rehash(%p): " UINT_FMT " -> " UINT_FMT "\n", map, old_alloc, new_alloc);
138139
mp_map_elem_t *old_table = map->table;
140+
// CIRCUITPY-CHANGE
139141
mp_map_elem_t *new_table = malloc_table(new_alloc);
140142
// If we reach this point, table resizing succeeded, now we can edit the old map.
141143
map->alloc = new_alloc;
@@ -332,6 +334,7 @@ mp_map_elem_t *MICROPY_WRAP_MP_MAP_LOOKUP(mp_map_lookup)(mp_map_t * map, mp_obj_
332334
void mp_set_init(mp_set_t *set, size_t n) {
333335
set->alloc = n;
334336
set->used = 0;
337+
// CIRCUITPY-CHANGE
335338
set->table = m_malloc_items0(set->alloc);
336339
}
337340

@@ -340,6 +343,7 @@ static void mp_set_rehash(mp_set_t *set) {
340343
mp_obj_t *old_table = set->table;
341344
set->alloc = get_hash_alloc_greater_or_equal_to(set->alloc + 1);
342345
set->used = 0;
346+
// CIRCUITPY-CHANGE
343347
set->table = m_malloc_items0(set->alloc);
344348
for (size_t i = 0; i < old_alloc; i++) {
345349
if (old_table[i] != MP_OBJ_NULL && old_table[i] != MP_OBJ_SENTINEL) {

py/misc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ typedef unsigned int uint;
7474

7575
// TODO make a lazy m_renew that can increase by a smaller amount than requested (but by at least 1 more element)
7676

77+
// CIRCUITPY-CHANGE: new wrappers for selective collect, and use of m_malloc_helper()
7778
// The following are convenience wrappers for m_malloc_helper and can save space at the call sites.
7879
// m_malloc and m_new allocate space that is not collected and does not have a finaliser.
7980
// Use m_malloc_items() to allocate space for mp_obj_t that will be collected.

py/mpstate.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ typedef struct _mp_state_mem_area_t {
100100
#if MICROPY_ENABLE_FINALISER
101101
byte *gc_finaliser_table_start;
102102
#endif
103+
// CIRCUITPY-CHANGE
103104
#if MICROPY_ENABLE_SELECTIVE_COLLECT
104105
byte *gc_collect_table_start;
105106
#endif

py/obj.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747

4848
// Allocates an object and also sets type, for mp_obj_malloc{,_var} macros.
4949
MP_NOINLINE void *mp_obj_malloc_helper(size_t num_bytes, const mp_obj_type_t *type) {
50+
// CIRCUITPY-CHANGE
5051
mp_obj_base_t *base = (mp_obj_base_t *)m_malloc_helper(num_bytes, M_MALLOC_RAISE_ERROR | M_MALLOC_COLLECT);
5152
base->type = type;
5253
return base;
@@ -55,6 +56,7 @@ MP_NOINLINE void *mp_obj_malloc_helper(size_t num_bytes, const mp_obj_type_t *ty
5556
#if MICROPY_ENABLE_FINALISER
5657
// Allocates an object and also sets type, for mp_obj_malloc{,_var}_with_finaliser macros.
5758
MP_NOINLINE void *mp_obj_malloc_with_finaliser_helper(size_t num_bytes, const mp_obj_type_t *type) {
59+
// CIRCUITPY-CHANGE
5860
mp_obj_base_t *base = (mp_obj_base_t *)m_malloc_helper(num_bytes, M_MALLOC_RAISE_ERROR | M_MALLOC_COLLECT | M_MALLOC_WITH_FINALISER);
5961
base->type = type;
6062
return base;

py/objarray.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ static mp_obj_array_t *array_new(char typecode, size_t n) {
106106
}
107107
int typecode_size = mp_binary_get_size('@', typecode, NULL);
108108

109+
// CIRCUITPY-CHANGE: refactor to use m_obj_malloc()
109110
const mp_obj_type_t *type;
110111
#if MICROPY_PY_BUILTINS_BYTEARRAY && MICROPY_PY_ARRAY
111112
type = (typecode == BYTEARRAY_TYPECODE) ? &mp_type_bytearray : &mp_type_array;
@@ -118,6 +119,8 @@ static mp_obj_array_t *array_new(char typecode, size_t n) {
118119
o->typecode = typecode;
119120
o->free = 0;
120121
o->len = n;
122+
// CIRCUITPY-CHANGE
123+
// CIRCUITPY-CHANGE
121124
o->items = m_malloc(typecode_size * o->len);
122125
return o;
123126
}
@@ -227,6 +230,8 @@ static mp_obj_t bytearray_make_new(const mp_obj_type_t *type_in, size_t n_args,
227230
#if MICROPY_PY_BUILTINS_MEMORYVIEW
228231

229232
mp_obj_t mp_obj_new_memoryview(byte typecode, size_t nitems, void *items) {
233+
// CIRCUITPY-CHANGE
234+
// CIRCUITPY-CHANGE
230235
mp_obj_array_t *self = mp_obj_malloc(mp_obj_array_t, &mp_type_memoryview);
231236
mp_obj_memoryview_init(self, typecode, 0, nitems, items);
232237
return MP_OBJ_FROM_PTR(self);
@@ -686,6 +691,8 @@ static mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value
686691
if (slice.start > memview_offset_max) {
687692
mp_raise_msg(&mp_type_OverflowError, MP_ERROR_TEXT("memoryview offset too large"));
688693
}
694+
// CIRCUITPY-CHANGE
695+
// CIRCUITPY-CHANGE
689696
res = mp_obj_malloc(mp_obj_array_t, &mp_type_memoryview);
690697
*res = *o;
691698
res->memview_offset += slice.start;

py/objclosure.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ static mp_obj_t closure_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const
5050
return mp_call_function_n_kw(self->fun, self->n_closed + n_args, n_kw, args2);
5151
} else {
5252
// use heap to allocate temporary args array
53+
// CIRCUITPY-CHANGE
54+
// CIRCUITPY-CHANGE
5355
mp_obj_t *args2 = m_malloc_items(n_total);
5456
memcpy(args2, self->closed, self->n_closed * sizeof(mp_obj_t));
5557
memcpy(args2 + self->n_closed, args, (n_args + 2 * n_kw) * sizeof(mp_obj_t));

py/objdeque.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ static mp_obj_t deque_make_new(const mp_obj_type_t *type, size_t n_args, size_t
5858
mp_obj_deque_t *o = mp_obj_malloc(mp_obj_deque_t, type);
5959
o->alloc = maxlen + 1;
6060
o->i_get = o->i_put = 0;
61+
// CIRCUITPY-CHANGE
62+
// CIRCUITPY-CHANGE
6163
o->items = m_malloc_items(o->alloc);
6264

6365
if (n_args > 2) {

py/objexcept.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ mp_obj_t mp_alloc_emergency_exception_buf(mp_obj_t size_in) {
9494
mp_int_t size = mp_obj_get_int(size_in);
9595
void *buf = NULL;
9696
if (size > 0) {
97+
// CIRCUITPY-CHANGE
98+
// CIRCUITPY-CHANGE
9799
buf = m_malloc_with_collect(size);
98100
}
99101

@@ -220,6 +222,8 @@ mp_obj_t mp_obj_exception_make_new(const mp_obj_type_t *type, size_t n_args, siz
220222
mp_arg_check_num(n_args, n_kw, 0, MP_OBJ_FUN_ARGS_MAX, false);
221223

222224
// Try to allocate memory for the exception, with fallback to emergency exception object
225+
// CIRCUITPY-CHANGE
226+
// CIRCUITPY-CHANGE
223227
mp_obj_exception_t *o_exc = m_malloc_maybe_with_collect(sizeof(mp_obj_exception_t));
224228
if (o_exc == NULL) {
225229
o_exc = &MP_STATE_VM(mp_emergency_exception_obj);
@@ -544,6 +548,8 @@ mp_obj_t mp_obj_new_exception_msg_vlist(const mp_obj_type_t *exc_type, mp_rom_er
544548
// CIRCUITPY-CHANGE: here and more below
545549
size_t o_str_alloc = decompress_length(fmt);
546550
if (gc_alloc_possible()) {
551+
// CIRCUITPY-CHANGE
552+
// CIRCUITPY-CHANGE
547553
o_str = m_malloc_maybe_with_collect(sizeof(mp_obj_str_t));
548554
o_str_buf = m_new_maybe(byte, o_str_alloc);
549555
}
@@ -661,6 +667,8 @@ void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, size_t line, qs
661667

662668
// Try to allocate memory for the traceback, with fallback to emergency traceback object
663669
if (self->traceback == NULL || self->traceback == (mp_obj_traceback_t *)&mp_const_empty_traceback_obj) {
670+
// CIRCUITPY-CHANGE
671+
// CIRCUITPY-CHANGE
664672
self->traceback = m_malloc_maybe_with_collect(sizeof(mp_obj_traceback_t));
665673
if (self->traceback == NULL) {
666674
self->traceback = &MP_STATE_VM(mp_emergency_traceback_obj);

py/objtuple.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ static mp_obj_t mp_obj_tuple_make_new(const mp_obj_type_t *type_in, size_t n_arg
8686

8787
size_t alloc = 4;
8888
size_t len = 0;
89+
// CIRCUITPY-CHANGE
90+
// CIRCUITPY-CHANGE
8991
mp_obj_t *items = m_malloc_items(alloc);
9092

9193
mp_obj_t iterable = mp_getiter(args[0], NULL);

py/objtype.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ static mp_obj_t native_base_init_wrapper(size_t n_args, const mp_obj_t *pos_args
9696
pos_args++;
9797
n_args--;
9898

99+
// CIRCUITPY-CHANGE
100+
// CIRCUITPY-CHANGE
99101
mp_obj_t *args2 = m_malloc_items(n_args + 2 * n_kw);
100102
// copy in args
101103
memcpy(args2, pos_args, n_args * sizeof(mp_obj_t));
@@ -340,6 +342,8 @@ static mp_obj_t mp_obj_instance_make_new(const mp_obj_type_t *self, size_t n_arg
340342
mp_obj_t args2[1] = {MP_OBJ_FROM_PTR(self)};
341343
new_ret = mp_call_function_n_kw(init_fn[0], 1, 0, args2);
342344
} else {
345+
// CIRCUITPY-CHANGE
346+
// CIRCUITPY-CHANGE
343347
mp_obj_t *args2 = m_malloc_items(1 + n_args + 2 * n_kw);
344348
args2[0] = MP_OBJ_FROM_PTR(self);
345349
memcpy(args2 + 1, args, (n_args + 2 * n_kw) * sizeof(mp_obj_t));
@@ -371,6 +375,8 @@ static mp_obj_t mp_obj_instance_make_new(const mp_obj_type_t *self, size_t n_arg
371375
if (n_args == 0 && n_kw == 0) {
372376
init_ret = mp_call_method_n_kw(0, 0, init_fn);
373377
} else {
378+
// CIRCUITPY-CHANGE
379+
// CIRCUITPY-CHANGE
374380
mp_obj_t *args2 = m_malloc_items(2 + n_args + 2 * n_kw);
375381
args2[0] = init_fn[0];
376382
args2[1] = init_fn[1];
@@ -1513,6 +1519,8 @@ mp_obj_t mp_obj_cast_to_native_base(mp_obj_t self_in, mp_const_obj_t native_type
15131519
/******************************************************************************/
15141520
// staticmethod and classmethod types (probably should go in a different file)
15151521

1522+
// CIRCUITPY-CHANGE: better arg name
1523+
// CIRCUITPY-CHANGE: better arg name
15161524
static mp_obj_t static_class_method_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
15171525
assert(type == &mp_type_staticmethod || type == &mp_type_classmethod);
15181526

py/parse.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ static void *parser_alloc(parser_t *parser, size_t num_bytes) {
286286
if (alloc < num_bytes) {
287287
alloc = num_bytes;
288288
}
289+
// CIRCUITPY-CHANGE
290+
// CIRCUITPY-CHANGE
289291
chunk = (mp_parse_chunk_t *)m_malloc_with_collect(sizeof(mp_parse_chunk_t) + alloc);
290292
chunk->alloc = alloc;
291293
chunk->union_.used = 0;
@@ -1055,6 +1057,8 @@ mp_parse_tree_t mp_parse(mp_lexer_t *lex, mp_parse_input_kind_t input_kind) {
10551057
parser.result_stack_top = 0;
10561058
parser.result_stack = NULL;
10571059
while (parser.result_stack_alloc > 1) {
1060+
// CIRCUITPY-CHANGE
1061+
// CIRCUITPY-CHANGE
10581062
parser.result_stack = m_malloc_maybe_with_collect(sizeof(mp_parse_node_t) * parser.result_stack_alloc);
10591063
if (parser.result_stack != NULL) {
10601064
break;

py/scope.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ scope_t *scope_new(scope_kind_t kind, mp_parse_node_t pn, mp_uint_t emit_options
5151
MP_STATIC_ASSERT(MP_QSTR__lt_setcomp_gt_ <= UINT8_MAX);
5252
MP_STATIC_ASSERT(MP_QSTR__lt_genexpr_gt_ <= UINT8_MAX);
5353

54+
// CIRCUITPY-CHANGE
55+
// CIRCUITPY-CHANGE
5456
scope_t *scope = m_new_struct_with_collect(scope_t, 1);
5557
scope->kind = kind;
5658
scope->pn = pn;

shared-bindings/displayio/Group.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,14 @@ static mp_obj_t group_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t valu
317317
//|
318318
static mp_obj_t displayio_group_obj_sort(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
319319
displayio_group_t *self = native_group(pos_args[0]);
320+
// CIRCUITPY-CHANGE
321+
// CIRCUITPY-CHANGE
320322
mp_obj_t *args = m_malloc_items(n_args);
321323
for (size_t i = 1; i < n_args; ++i) {
322324
args[i] = pos_args[i];
323325
}
324326
args[0] = MP_OBJ_FROM_PTR(self->members);
327+
// CIRCUITPY-CHANGE
325328
mp_obj_t res = mp_obj_list_sort(n_args, args, kw_args);
326329
m_del(mp_obj_t, args, n_args);
327330
return res;

shared-module/fontio/BuiltinFont.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ mp_obj_t common_hal_fontio_builtinfont_get_bitmap(const fontio_builtinfont_t *se
1616
}
1717

1818
mp_obj_t common_hal_fontio_builtinfont_get_bounding_box(const fontio_builtinfont_t *self) {
19+
// CIRCUITPY-CHANGE
1920
// Stack allocation is ok because tuple copies the values out.
2021
mp_obj_t items[2];
2122
items[0] = MP_OBJ_NEW_SMALL_INT(self->width);

0 commit comments

Comments
 (0)