Skip to content

Commit

Permalink
Merge pull request #4649 from tannewt/merge_1.11_2
Browse files Browse the repository at this point in the history
Merge MicroPython v1.11 into CircuitPython
  • Loading branch information
tannewt authored Apr 27, 2021
2 parents f99deed + 76033d5 commit 17fcd49
Show file tree
Hide file tree
Showing 297 changed files with 6,818 additions and 4,588 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
url = https://github.com/adafruit/Adafruit_CircuitPython_Register.git
[submodule "extmod/ulab"]
path = extmod/ulab
url = https://github.com/v923z/micropython-ulab
url = https://github.com/adafruit/circuitpython-ulab
[submodule "frozen/Adafruit_CircuitPython_ESP32SPI"]
path = frozen/Adafruit_CircuitPython_ESP32SPI
url = https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2013, 2014 Damien P. George
Copyright (c) 2013-2019 Damien P. George

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions devices/ble_hci/common-hal/_bleio/Adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,10 +886,10 @@ uint16_t bleio_adapter_add_attribute(bleio_adapter_obj_t *adapter, mp_obj_t *att
uint16_t handle = (uint16_t)adapter->attributes->len;
mp_obj_list_append(adapter->attributes, attribute);

if (MP_OBJ_IS_TYPE(attribute, &bleio_service_type)) {
if (mp_obj_is_type(attribute, &bleio_service_type)) {
adapter->last_added_service_handle = handle;
}
if (MP_OBJ_IS_TYPE(attribute, &bleio_characteristic_type)) {
if (mp_obj_is_type(attribute, &bleio_characteristic_type)) {
adapter->last_added_characteristic_handle = handle;
}

Expand Down
6 changes: 3 additions & 3 deletions devices/ble_hci/common-hal/_bleio/Attribute.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@


bleio_uuid_obj_t *bleio_attribute_get_uuid(mp_obj_t *attribute) {
if (MP_OBJ_IS_TYPE(attribute, &bleio_characteristic_type)) {
if (mp_obj_is_type(attribute, &bleio_characteristic_type)) {
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute);
return characteristic->uuid;
}
if (MP_OBJ_IS_TYPE(attribute, &bleio_descriptor_type)) {
if (mp_obj_is_type(attribute, &bleio_descriptor_type)) {
bleio_descriptor_obj_t *descriptor = MP_OBJ_TO_PTR(attribute);
return descriptor->uuid;
}
if (MP_OBJ_IS_TYPE(attribute, &bleio_service_type)) {
if (mp_obj_is_type(attribute, &bleio_service_type)) {
bleio_service_obj_t *service = MP_OBJ_TO_PTR(attribute);
return service->uuid;
}
Expand Down
4 changes: 2 additions & 2 deletions devices/ble_hci/common-hal/_bleio/Characteristic.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ bool bleio_characteristic_set_local_value(bleio_characteristic_obj_t *self, mp_b

self->value = mp_obj_new_bytes(bufinfo->buf, bufinfo->len);

if (MP_OBJ_IS_TYPE(self->observer, &bleio_characteristic_buffer_type)) {
if (mp_obj_is_type(self->observer, &bleio_characteristic_buffer_type)) {
bleio_characteristic_buffer_update(MP_OBJ_FROM_PTR(self->observer), bufinfo);
} else if (MP_OBJ_IS_TYPE(self->observer, &bleio_packet_buffer_type)) {
} else if (mp_obj_is_type(self->observer, &bleio_packet_buffer_type)) {
bleio_packet_buffer_update(MP_OBJ_FROM_PTR(self->observer), bufinfo);
} else {
return false;
Expand Down
2 changes: 1 addition & 1 deletion devices/ble_hci/common-hal/_bleio/Connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ void common_hal_bleio_connection_set_connection_interval(bleio_connection_intern
// mp_obj_t iterable = mp_getiter(service_uuids_whitelist, &iter_buf);
// mp_obj_t uuid_obj;
// while ((uuid_obj = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) {
// if (!MP_OBJ_IS_TYPE(uuid_obj, &bleio_uuid_type)) {
// if (!mp_obj_is_type(uuid_obj, &bleio_uuid_type)) {
// mp_raise_TypeError(translate("non-UUID found in service_uuids_whitelist"));
// }
// bleio_uuid_obj_t *uuid = MP_OBJ_TO_PTR(uuid_obj);
Expand Down
24 changes: 12 additions & 12 deletions devices/ble_hci/common-hal/_bleio/att.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ void att_remove_connection(uint16_t conn_handle, uint8_t reason) {
.len = sizeof(zero),
};

if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_descriptor_type)) {
if (mp_obj_is_type(attribute_obj, &bleio_descriptor_type)) {
bleio_descriptor_obj_t *descriptor = MP_OBJ_TO_PTR(attribute_obj);
if (bleio_uuid_get_uuid16_or_unknown(descriptor->uuid) == BLE_UUID_CCCD) {
common_hal_bleio_descriptor_set_value(descriptor, &zero_cccd_value);
Expand Down Expand Up @@ -800,7 +800,7 @@ STATIC void process_find_info_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
// Fetch the uuid for the given attribute, which might be a characteristic or a descriptor.
bleio_uuid_obj_t *uuid;

if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_characteristic_type)) {
if (mp_obj_is_type(attribute_obj, &bleio_characteristic_type)) {
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute_obj);
if (characteristic->handle != handle) {
// If the handles don't match, this is the characteristic definition attribute.
Expand Down Expand Up @@ -971,7 +971,7 @@ void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, ui
}

mp_obj_t *attribute_obj = bleio_adapter_get_attribute(&common_hal_bleio_adapter_obj, handle);
if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_service_type)) {
if (mp_obj_is_type(attribute_obj, &bleio_service_type)) {
bleio_service_obj_t *service = MP_OBJ_TO_PTR(attribute_obj);

// Is this a 16-bit or a 128-bit uuid? It must match in size with any previous attribute
Expand Down Expand Up @@ -1083,7 +1083,7 @@ STATIC void process_read_or_read_blob_req(uint16_t conn_handle, uint16_t mtu, ui
size_t rsp_length = sizeof(rsp_t);

mp_obj_t *attribute_obj = bleio_adapter_get_attribute(&common_hal_bleio_adapter_obj, handle);
if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_service_type)) {
if (mp_obj_is_type(attribute_obj, &bleio_service_type)) {
if (offset) {
send_error(conn_handle, BT_ATT_ERR_ATTRIBUTE_NOT_LONG, handle, BT_ATT_ERR_INVALID_PDU);
return;
Expand All @@ -1095,7 +1095,7 @@ STATIC void process_read_or_read_blob_req(uint16_t conn_handle, uint16_t mtu, ui
common_hal_bleio_uuid_pack_into(service->uuid, rsp->r.value);
rsp_length += sizeof_service_uuid;

} else if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_characteristic_type)) {
} else if (mp_obj_is_type(attribute_obj, &bleio_characteristic_type)) {
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute_obj);
if (characteristic->decl_handle == handle) {
// Read characteristic declaration. Return properties, value handle, and uuid.
Expand Down Expand Up @@ -1135,7 +1135,7 @@ STATIC void process_read_or_read_blob_req(uint16_t conn_handle, uint16_t mtu, ui
memcpy(rsp->r.value, bufinfo.buf + offset, value_length);
rsp_length += value_length;
}
} else if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_descriptor_type)) {
} else if (mp_obj_is_type(attribute_obj, &bleio_descriptor_type)) {
bleio_descriptor_obj_t *descriptor = MP_OBJ_TO_PTR(attribute_obj);

mp_buffer_info_t bufinfo;
Expand Down Expand Up @@ -1203,7 +1203,7 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
mp_obj_t *attribute_obj = bleio_adapter_get_attribute(&common_hal_bleio_adapter_obj, handle);

if (type_uuid == BLE_UUID_CHARACTERISTIC &&
MP_OBJ_IS_TYPE(attribute_obj, &bleio_characteristic_type)) {
mp_obj_is_type(attribute_obj, &bleio_characteristic_type)) {
// Request is for characteristic declarations.
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute_obj);

Expand Down Expand Up @@ -1250,7 +1250,7 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
rsp_length += data_length;
no_data = false;

} else if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_descriptor_type)) {
} else if (mp_obj_is_type(attribute_obj, &bleio_descriptor_type)) {
// See if request is for a descriptor value with a 16-bit UUID, such as the CCCD.
bleio_descriptor_obj_t *descriptor = MP_OBJ_TO_PTR(attribute_obj);
if (bleio_uuid_get_uuid16_or_unknown(descriptor->uuid) == type_uuid) {
Expand All @@ -1271,7 +1271,7 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
break;
}

} else if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_characteristic_type)) {
} else if (mp_obj_is_type(attribute_obj, &bleio_characteristic_type)) {
// See if request is for a characteristic value with a 16-bit UUID.
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute_obj);
if (bleio_uuid_get_uuid16_or_unknown(characteristic->uuid) == type_uuid) {
Expand Down Expand Up @@ -1359,7 +1359,7 @@ STATIC void process_write_req_or_cmd(uint16_t conn_handle, uint16_t mtu, uint8_t

mp_obj_t attribute_obj = bleio_adapter_get_attribute(&common_hal_bleio_adapter_obj, req->handle);

if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_characteristic_type)) {
if (mp_obj_is_type(attribute_obj, &bleio_characteristic_type)) {
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute_obj);

// Don't write the characteristic declaration.
Expand All @@ -1377,7 +1377,7 @@ STATIC void process_write_req_or_cmd(uint16_t conn_handle, uint16_t mtu, uint8_t
// Just change the local value. Don't fire off notifications, etc.
bleio_characteristic_set_local_value(characteristic, &bufinfo);

} else if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_descriptor_type)) {
} else if (mp_obj_is_type(attribute_obj, &bleio_descriptor_type)) {
bleio_descriptor_obj_t *descriptor = MP_OBJ_TO_PTR(attribute_obj);
// Only CCCD's are writable.
if (bleio_uuid_get_uuid16_or_unknown(descriptor->uuid) != BLE_UUID_CCCD) {
Expand Down Expand Up @@ -1427,7 +1427,7 @@ STATIC void process_prepare_write_req(uint16_t conn_handle, uint16_t mtu, uint8_

mp_obj_t *attribute = bleio_adapter_get_attribute(&common_hal_bleio_adapter_obj, handle);

if (!MP_OBJ_IS_TYPE(attribute, &bleio_characteristic_type)) {
if (!mp_obj_is_type(attribute, &bleio_characteristic_type)) {
send_error(conn_handle, BT_ATT_OP_PREPARE_WRITE_REQ, handle, BT_ATT_ERR_ATTRIBUTE_NOT_LONG);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion docs/library/re.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Match objects
Match objects as returned by `match()` and `search()` methods, and passed
to the replacement function in `sub()`.

.. method:: match.group([index])
.. method:: match.group(index)

Return matching (sub)string. *index* is 0 for entire match,
1 and above for each capturing group. Only numeric groups are supported.
Expand Down
1 change: 1 addition & 0 deletions extmod/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_uos_dupterm_obj);

#if MICROPY_PY_OS_DUPTERM
bool mp_uos_dupterm_is_builtin_stream(mp_const_obj_t stream);
int mp_uos_dupterm_rx_chr(void);
void mp_uos_dupterm_tx_strn(const char *str, size_t len);
void mp_uos_deactivate(size_t dupterm_idx, const char *msg, mp_obj_t exc);
Expand Down
2 changes: 1 addition & 1 deletion extmod/modubinascii.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

static void check_not_unicode(const mp_obj_t arg) {
#if MICROPY_CPYTHON_COMPAT
if (MP_OBJ_IS_STR(arg)) {
if (mp_obj_is_str(arg)) {
mp_raise_TypeError(translate("a bytes-like object is required"));
}
#endif
Expand Down
38 changes: 19 additions & 19 deletions extmod/moductypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ STATIC void uctypes_struct_print(const mp_print_t *print, mp_obj_t self_in, mp_p
(void)kind;
mp_obj_uctypes_struct_t *self = MP_OBJ_TO_PTR(self_in);
const char *typen = "unk";
if (MP_OBJ_IS_TYPE(self->desc, &mp_type_dict)
if (mp_obj_is_type(self->desc, &mp_type_dict)
#if MICROPY_PY_COLLECTIONS_ORDEREDDICT
|| MP_OBJ_IS_TYPE(self->desc, &mp_type_ordereddict)
|| mp_obj_is_type(self->desc, &mp_type_ordereddict)
#endif
) {
typen = "STRUCT";
} else if (MP_OBJ_IS_TYPE(self->desc, &mp_type_tuple)) {
} else if (mp_obj_is_type(self->desc, &mp_type_tuple)) {
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(self->desc);
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(t->items[0]);
uint agg_type = GET_TYPE(offset, AGG_TYPE_BITS);
Expand Down Expand Up @@ -195,14 +195,14 @@ STATIC mp_uint_t uctypes_struct_agg_size(mp_obj_tuple_t *t, int layout_type, mp_
}

STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_t *max_field_size) {
if (!MP_OBJ_IS_TYPE(desc_in, &mp_type_dict)
if (!mp_obj_is_type(desc_in, &mp_type_dict)
#if MICROPY_PY_COLLECTIONS_ORDEREDDICT
&& !MP_OBJ_IS_TYPE(desc_in, &mp_type_ordereddict)
&& !mp_obj_is_type(desc_in, &mp_type_ordereddict)
#endif
) {
if (MP_OBJ_IS_TYPE(desc_in, &mp_type_tuple)) {
if (mp_obj_is_type(desc_in, &mp_type_tuple)) {
return uctypes_struct_agg_size((mp_obj_tuple_t *)MP_OBJ_TO_PTR(desc_in), layout_type, max_field_size);
} else if (MP_OBJ_IS_SMALL_INT(desc_in)) {
} else if (mp_obj_is_small_int(desc_in)) {
// We allow sizeof on both type definitions and structures/structure fields,
// but scalar structure field is lowered into native Python int, so all
// type info is lost. So, we cannot say if it's scalar type description,
Expand All @@ -216,9 +216,9 @@ STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_
mp_uint_t total_size = 0;

for (mp_uint_t i = 0; i < d->map.alloc; i++) {
if (MP_MAP_SLOT_IS_FILLED(&d->map, i)) {
if (mp_map_slot_is_filled(&d->map, i)) {
mp_obj_t v = d->map.table[i].value;
if (MP_OBJ_IS_SMALL_INT(v)) {
if (mp_obj_is_small_int(v)) {
mp_uint_t offset = MP_OBJ_SMALL_INT_VALUE(v);
mp_uint_t val_type = GET_TYPE(offset, VAL_TYPE_BITS);
offset &= VALUE_MASK(VAL_TYPE_BITS);
Expand All @@ -233,7 +233,7 @@ STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_
total_size = offset + s;
}
} else {
if (!MP_OBJ_IS_TYPE(v, &mp_type_tuple)) {
if (!mp_obj_is_type(v, &mp_type_tuple)) {
syntax_error();
}
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(v);
Expand All @@ -257,13 +257,13 @@ STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_
STATIC mp_obj_t uctypes_struct_sizeof(size_t n_args, const mp_obj_t *args) {
mp_obj_t obj_in = args[0];
mp_uint_t max_field_size = 0;
if (MP_OBJ_IS_TYPE(obj_in, &mp_type_bytearray)) {
if (mp_obj_is_type(obj_in, &mp_type_bytearray)) {
return mp_obj_len(obj_in);
}
int layout_type = LAYOUT_NATIVE;
// We can apply sizeof either to structure definition (a dict)
// or to instantiated structure
if (MP_OBJ_IS_TYPE(obj_in, &uctypes_struct_type)) {
if (mp_obj_is_type(obj_in, &uctypes_struct_type)) {
if (n_args != 1) {
mp_raise_TypeError(NULL);
}
Expand Down Expand Up @@ -400,16 +400,16 @@ STATIC void set_aligned(uint val_type, void *p, mp_int_t index, mp_obj_t val) {
STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set_val) {
mp_obj_uctypes_struct_t *self = MP_OBJ_TO_PTR(self_in);

if (!MP_OBJ_IS_TYPE(self->desc, &mp_type_dict)
if (!mp_obj_is_type(self->desc, &mp_type_dict)
#if MICROPY_PY_COLLECTIONS_ORDEREDDICT
&& !MP_OBJ_IS_TYPE(self->desc, &mp_type_ordereddict)
&& !mp_obj_is_type(self->desc, &mp_type_ordereddict)
#endif
) {
mp_raise_TypeError(translate("struct: no fields"));
}

mp_obj_t deref = mp_obj_dict_get(self->desc, MP_OBJ_NEW_QSTR(attr));
if (MP_OBJ_IS_SMALL_INT(deref)) {
if (mp_obj_is_small_int(deref)) {
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(deref);
mp_uint_t val_type = GET_TYPE(offset, VAL_TYPE_BITS);
offset &= VALUE_MASK(VAL_TYPE_BITS);
Expand Down Expand Up @@ -470,7 +470,7 @@ STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set
return MP_OBJ_NULL;
}

if (!MP_OBJ_IS_TYPE(deref, &mp_type_tuple)) {
if (!mp_obj_is_type(deref, &mp_type_tuple)) {
syntax_error();
}

Expand Down Expand Up @@ -537,7 +537,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t base_in, mp_obj_t index_in, mp_ob
return MP_OBJ_NULL; // op not supported
} else {
// load / store
if (!MP_OBJ_IS_TYPE(self->desc, &mp_type_tuple)) {
if (!mp_obj_is_type(self->desc, &mp_type_tuple)) {
mp_raise_TypeError(translate("struct: cannot index"));
}

Expand Down Expand Up @@ -588,7 +588,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t base_in, mp_obj_t index_in, mp_ob

} else if (agg_type == PTR) {
byte *p = *(void **)self->addr;
if (MP_OBJ_IS_SMALL_INT(t->items[1])) {
if (mp_obj_is_small_int(t->items[1])) {
uint val_type = GET_TYPE(MP_OBJ_SMALL_INT_VALUE(t->items[1]), VAL_TYPE_BITS);
return get_aligned(val_type, p, index);
} else {
Expand All @@ -612,7 +612,7 @@ STATIC mp_obj_t uctypes_struct_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
mp_obj_uctypes_struct_t *self = MP_OBJ_TO_PTR(self_in);
switch (op) {
case MP_UNARY_OP_INT:
if (MP_OBJ_IS_TYPE(self->desc, &mp_type_tuple)) {
if (mp_obj_is_type(self->desc, &mp_type_tuple)) {
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(self->desc);
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(t->items[0]);
uint agg_type = GET_TYPE(offset, AGG_TYPE_BITS);
Expand Down
10 changes: 5 additions & 5 deletions extmod/moduhashlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,16 @@ STATIC mp_obj_t uhashlib_sha256_digest(mp_obj_t self_in) {

static void check_not_unicode(const mp_obj_t arg) {
#if MICROPY_CPYTHON_COMPAT
if (MP_OBJ_IS_STR(arg)) {
if (mp_obj_is_str(arg)) {
mp_raise_TypeError(translate("a bytes-like object is required"));
}
#endif
}

#if MICROPY_PY_UHASHLIB_SHA256
#include "crypto-algorithms/sha256.c"
#endif

STATIC mp_obj_t uhashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
mp_arg_check_num(n_args, kw_args, 0, 1, false);
mp_obj_hash_t *o = m_new_obj_var(mp_obj_hash_t, char, sizeof(CRYAL_SHA256_CTX));
Expand Down Expand Up @@ -336,8 +340,4 @@ const mp_obj_module_t mp_module_uhashlib = {
.globals = (mp_obj_dict_t *)&mp_module_uhashlib_globals,
};

#if MICROPY_PY_UHASHLIB_SHA256
#include "crypto-algorithms/sha256.c"
#endif

#endif // MICROPY_PY_UHASHLIB
2 changes: 1 addition & 1 deletion extmod/moduheapq.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// the algorithm here is modelled on CPython's heapq.py

STATIC mp_obj_list_t *get_heap(mp_obj_t heap_in) {
if (!MP_OBJ_IS_TYPE(heap_in, &mp_type_list)) {
if (!mp_obj_is_type(heap_in, &mp_type_list)) {
mp_raise_TypeError(translate("heap must be a list"));
}
return MP_OBJ_TO_PTR(heap_in);
Expand Down
2 changes: 1 addition & 1 deletion extmod/modujson.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ STATIC mp_obj_t _mod_ujson_load(mp_obj_t stream_obj, bool return_first_json) {
cur = S_CUR(s);
if (cur == '.' || cur == 'E' || cur == 'e') {
flt = true;
} else if (cur == '-' || unichar_isdigit(cur)) {
} else if (cur == '+' || cur == '-' || unichar_isdigit(cur)) {
// pass
} else {
break;
Expand Down
11 changes: 11 additions & 0 deletions extmod/modurandom.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,19 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_urandom_uniform_obj, mod_urandom_uniform);

#endif // MICROPY_PY_URANDOM_EXTRA_FUNCS

#ifdef MICROPY_PY_URANDOM_SEED_INIT_FUNC
STATIC mp_obj_t mod_urandom___init__() {
mod_urandom_seed(MP_OBJ_NEW_SMALL_INT(MICROPY_PY_URANDOM_SEED_INIT_FUNC));
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_urandom___init___obj, mod_urandom___init__);
#endif

STATIC const mp_rom_map_elem_t mp_module_urandom_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_urandom) },
#ifdef MICROPY_PY_URANDOM_SEED_INIT_FUNC
{ MP_ROM_QSTR(MP_QSTR___init__), MP_ROM_PTR(&mod_urandom___init___obj) },
#endif
{ MP_ROM_QSTR(MP_QSTR_getrandbits), MP_ROM_PTR(&mod_urandom_getrandbits_obj) },
{ MP_ROM_QSTR(MP_QSTR_seed), MP_ROM_PTR(&mod_urandom_seed_obj) },
#if MICROPY_PY_URANDOM_EXTRA_FUNCS
Expand Down
Loading

0 comments on commit 17fcd49

Please sign in to comment.