Skip to content

Commit b4e05da

Browse files
Merge pull request #4 from adafruit/main
from main
2 parents 346740e + 17fcd49 commit b4e05da

File tree

378 files changed

+8674
-4989
lines changed

Some content is hidden

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

378 files changed

+8674
-4989
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ jobs:
498498
id: idf-cache
499499
with:
500500
path: ${{ github.workspace }}/.idf_tools
501-
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210415
501+
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210422
502502
- name: Clone IDF submodules
503503
run: |
504504
(cd $IDF_PATH && git submodule update --init)

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
url = https://github.com/adafruit/Adafruit_CircuitPython_Register.git
114114
[submodule "extmod/ulab"]
115115
path = extmod/ulab
116-
url = https://github.com/v923z/micropython-ulab
116+
url = https://github.com/adafruit/circuitpython-ulab
117117
[submodule "frozen/Adafruit_CircuitPython_ESP32SPI"]
118118
path = frozen/Adafruit_CircuitPython_ESP32SPI
119119
url = https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

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

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

devices/ble_hci/common-hal/_bleio/Adapter.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,10 +886,10 @@ uint16_t bleio_adapter_add_attribute(bleio_adapter_obj_t *adapter, mp_obj_t *att
886886
uint16_t handle = (uint16_t)adapter->attributes->len;
887887
mp_obj_list_append(adapter->attributes, attribute);
888888

889-
if (MP_OBJ_IS_TYPE(attribute, &bleio_service_type)) {
889+
if (mp_obj_is_type(attribute, &bleio_service_type)) {
890890
adapter->last_added_service_handle = handle;
891891
}
892-
if (MP_OBJ_IS_TYPE(attribute, &bleio_characteristic_type)) {
892+
if (mp_obj_is_type(attribute, &bleio_characteristic_type)) {
893893
adapter->last_added_characteristic_handle = handle;
894894
}
895895

devices/ble_hci/common-hal/_bleio/Attribute.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333

3434

3535
bleio_uuid_obj_t *bleio_attribute_get_uuid(mp_obj_t *attribute) {
36-
if (MP_OBJ_IS_TYPE(attribute, &bleio_characteristic_type)) {
36+
if (mp_obj_is_type(attribute, &bleio_characteristic_type)) {
3737
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute);
3838
return characteristic->uuid;
3939
}
40-
if (MP_OBJ_IS_TYPE(attribute, &bleio_descriptor_type)) {
40+
if (mp_obj_is_type(attribute, &bleio_descriptor_type)) {
4141
bleio_descriptor_obj_t *descriptor = MP_OBJ_TO_PTR(attribute);
4242
return descriptor->uuid;
4343
}
44-
if (MP_OBJ_IS_TYPE(attribute, &bleio_service_type)) {
44+
if (mp_obj_is_type(attribute, &bleio_service_type)) {
4545
bleio_service_obj_t *service = MP_OBJ_TO_PTR(attribute);
4646
return service->uuid;
4747
}

devices/ble_hci/common-hal/_bleio/Characteristic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,9 @@ bool bleio_characteristic_set_local_value(bleio_characteristic_obj_t *self, mp_b
213213

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

216-
if (MP_OBJ_IS_TYPE(self->observer, &bleio_characteristic_buffer_type)) {
216+
if (mp_obj_is_type(self->observer, &bleio_characteristic_buffer_type)) {
217217
bleio_characteristic_buffer_update(MP_OBJ_FROM_PTR(self->observer), bufinfo);
218-
} else if (MP_OBJ_IS_TYPE(self->observer, &bleio_packet_buffer_type)) {
218+
} else if (mp_obj_is_type(self->observer, &bleio_packet_buffer_type)) {
219219
bleio_packet_buffer_update(MP_OBJ_FROM_PTR(self->observer), bufinfo);
220220
} else {
221221
return false;

devices/ble_hci/common-hal/_bleio/Connection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ void common_hal_bleio_connection_set_connection_interval(bleio_connection_intern
644644
// mp_obj_t iterable = mp_getiter(service_uuids_whitelist, &iter_buf);
645645
// mp_obj_t uuid_obj;
646646
// while ((uuid_obj = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) {
647-
// if (!MP_OBJ_IS_TYPE(uuid_obj, &bleio_uuid_type)) {
647+
// if (!mp_obj_is_type(uuid_obj, &bleio_uuid_type)) {
648648
// mp_raise_TypeError(translate("non-UUID found in service_uuids_whitelist"));
649649
// }
650650
// bleio_uuid_obj_t *uuid = MP_OBJ_TO_PTR(uuid_obj);

devices/ble_hci/common-hal/_bleio/att.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ void att_remove_connection(uint16_t conn_handle, uint8_t reason) {
539539
.len = sizeof(zero),
540540
};
541541

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

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

973973
mp_obj_t *attribute_obj = bleio_adapter_get_attribute(&common_hal_bleio_adapter_obj, handle);
974-
if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_service_type)) {
974+
if (mp_obj_is_type(attribute_obj, &bleio_service_type)) {
975975
bleio_service_obj_t *service = MP_OBJ_TO_PTR(attribute_obj);
976976

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

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

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

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

12051205
if (type_uuid == BLE_UUID_CHARACTERISTIC &&
1206-
MP_OBJ_IS_TYPE(attribute_obj, &bleio_characteristic_type)) {
1206+
mp_obj_is_type(attribute_obj, &bleio_characteristic_type)) {
12071207
// Request is for characteristic declarations.
12081208
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute_obj);
12091209

@@ -1250,7 +1250,7 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
12501250
rsp_length += data_length;
12511251
no_data = false;
12521252

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

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

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

1362-
if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_characteristic_type)) {
1362+
if (mp_obj_is_type(attribute_obj, &bleio_characteristic_type)) {
13631363
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute_obj);
13641364

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

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

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

1430-
if (!MP_OBJ_IS_TYPE(attribute, &bleio_characteristic_type)) {
1430+
if (!mp_obj_is_type(attribute, &bleio_characteristic_type)) {
14311431
send_error(conn_handle, BT_ATT_OP_PREPARE_WRITE_REQ, handle, BT_ATT_ERR_ATTRIBUTE_NOT_LONG);
14321432
return;
14331433
}

docs/library/re.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ Match objects
174174
Match objects as returned by `match()` and `search()` methods, and passed
175175
to the replacement function in `sub()`.
176176

177-
.. method:: match.group([index])
177+
.. method:: match.group(index)
178178

179179
Return matching (sub)string. *index* is 0 for entire match,
180180
1 and above for each capturing group. Only numeric groups are supported.

extmod/misc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_uos_dupterm_obj);
1616

1717
#if MICROPY_PY_OS_DUPTERM
18+
bool mp_uos_dupterm_is_builtin_stream(mp_const_obj_t stream);
1819
int mp_uos_dupterm_rx_chr(void);
1920
void mp_uos_dupterm_tx_strn(const char *str, size_t len);
2021
void mp_uos_deactivate(size_t dupterm_idx, const char *msg, mp_obj_t exc);

extmod/modubinascii.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
static void check_not_unicode(const mp_obj_t arg) {
1515
#if MICROPY_CPYTHON_COMPAT
16-
if (MP_OBJ_IS_STR(arg)) {
16+
if (mp_obj_is_str(arg)) {
1717
mp_raise_TypeError(translate("a bytes-like object is required"));
1818
}
1919
#endif

extmod/moductypes.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ STATIC void uctypes_struct_print(const mp_print_t *print, mp_obj_t self_in, mp_p
118118
(void)kind;
119119
mp_obj_uctypes_struct_t *self = MP_OBJ_TO_PTR(self_in);
120120
const char *typen = "unk";
121-
if (MP_OBJ_IS_TYPE(self->desc, &mp_type_dict)
121+
if (mp_obj_is_type(self->desc, &mp_type_dict)
122122
#if MICROPY_PY_COLLECTIONS_ORDEREDDICT
123-
|| MP_OBJ_IS_TYPE(self->desc, &mp_type_ordereddict)
123+
|| mp_obj_is_type(self->desc, &mp_type_ordereddict)
124124
#endif
125125
) {
126126
typen = "STRUCT";
127-
} else if (MP_OBJ_IS_TYPE(self->desc, &mp_type_tuple)) {
127+
} else if (mp_obj_is_type(self->desc, &mp_type_tuple)) {
128128
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(self->desc);
129129
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(t->items[0]);
130130
uint agg_type = GET_TYPE(offset, AGG_TYPE_BITS);
@@ -195,14 +195,14 @@ STATIC mp_uint_t uctypes_struct_agg_size(mp_obj_tuple_t *t, int layout_type, mp_
195195
}
196196

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

218218
for (mp_uint_t i = 0; i < d->map.alloc; i++) {
219-
if (MP_MAP_SLOT_IS_FILLED(&d->map, i)) {
219+
if (mp_map_slot_is_filled(&d->map, i)) {
220220
mp_obj_t v = d->map.table[i].value;
221-
if (MP_OBJ_IS_SMALL_INT(v)) {
221+
if (mp_obj_is_small_int(v)) {
222222
mp_uint_t offset = MP_OBJ_SMALL_INT_VALUE(v);
223223
mp_uint_t val_type = GET_TYPE(offset, VAL_TYPE_BITS);
224224
offset &= VALUE_MASK(VAL_TYPE_BITS);
@@ -233,7 +233,7 @@ STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_
233233
total_size = offset + s;
234234
}
235235
} else {
236-
if (!MP_OBJ_IS_TYPE(v, &mp_type_tuple)) {
236+
if (!mp_obj_is_type(v, &mp_type_tuple)) {
237237
syntax_error();
238238
}
239239
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(v);
@@ -257,13 +257,13 @@ STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_
257257
STATIC mp_obj_t uctypes_struct_sizeof(size_t n_args, const mp_obj_t *args) {
258258
mp_obj_t obj_in = args[0];
259259
mp_uint_t max_field_size = 0;
260-
if (MP_OBJ_IS_TYPE(obj_in, &mp_type_bytearray)) {
260+
if (mp_obj_is_type(obj_in, &mp_type_bytearray)) {
261261
return mp_obj_len(obj_in);
262262
}
263263
int layout_type = LAYOUT_NATIVE;
264264
// We can apply sizeof either to structure definition (a dict)
265265
// or to instantiated structure
266-
if (MP_OBJ_IS_TYPE(obj_in, &uctypes_struct_type)) {
266+
if (mp_obj_is_type(obj_in, &uctypes_struct_type)) {
267267
if (n_args != 1) {
268268
mp_raise_TypeError(NULL);
269269
}
@@ -400,16 +400,16 @@ STATIC void set_aligned(uint val_type, void *p, mp_int_t index, mp_obj_t val) {
400400
STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set_val) {
401401
mp_obj_uctypes_struct_t *self = MP_OBJ_TO_PTR(self_in);
402402

403-
if (!MP_OBJ_IS_TYPE(self->desc, &mp_type_dict)
403+
if (!mp_obj_is_type(self->desc, &mp_type_dict)
404404
#if MICROPY_PY_COLLECTIONS_ORDEREDDICT
405-
&& !MP_OBJ_IS_TYPE(self->desc, &mp_type_ordereddict)
405+
&& !mp_obj_is_type(self->desc, &mp_type_ordereddict)
406406
#endif
407407
) {
408408
mp_raise_TypeError(translate("struct: no fields"));
409409
}
410410

411411
mp_obj_t deref = mp_obj_dict_get(self->desc, MP_OBJ_NEW_QSTR(attr));
412-
if (MP_OBJ_IS_SMALL_INT(deref)) {
412+
if (mp_obj_is_small_int(deref)) {
413413
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(deref);
414414
mp_uint_t val_type = GET_TYPE(offset, VAL_TYPE_BITS);
415415
offset &= VALUE_MASK(VAL_TYPE_BITS);
@@ -470,7 +470,7 @@ STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set
470470
return MP_OBJ_NULL;
471471
}
472472

473-
if (!MP_OBJ_IS_TYPE(deref, &mp_type_tuple)) {
473+
if (!mp_obj_is_type(deref, &mp_type_tuple)) {
474474
syntax_error();
475475
}
476476

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

@@ -588,7 +588,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t base_in, mp_obj_t index_in, mp_ob
588588

589589
} else if (agg_type == PTR) {
590590
byte *p = *(void **)self->addr;
591-
if (MP_OBJ_IS_SMALL_INT(t->items[1])) {
591+
if (mp_obj_is_small_int(t->items[1])) {
592592
uint val_type = GET_TYPE(MP_OBJ_SMALL_INT_VALUE(t->items[1]), VAL_TYPE_BITS);
593593
return get_aligned(val_type, p, index);
594594
} else {
@@ -612,7 +612,7 @@ STATIC mp_obj_t uctypes_struct_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
612612
mp_obj_uctypes_struct_t *self = MP_OBJ_TO_PTR(self_in);
613613
switch (op) {
614614
case MP_UNARY_OP_INT:
615-
if (MP_OBJ_IS_TYPE(self->desc, &mp_type_tuple)) {
615+
if (mp_obj_is_type(self->desc, &mp_type_tuple)) {
616616
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(self->desc);
617617
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(t->items[0]);
618618
uint agg_type = GET_TYPE(offset, AGG_TYPE_BITS);

extmod/moduhashlib.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,16 @@ STATIC mp_obj_t uhashlib_sha256_digest(mp_obj_t self_in) {
8888

8989
static void check_not_unicode(const mp_obj_t arg) {
9090
#if MICROPY_CPYTHON_COMPAT
91-
if (MP_OBJ_IS_STR(arg)) {
91+
if (mp_obj_is_str(arg)) {
9292
mp_raise_TypeError(translate("a bytes-like object is required"));
9393
}
9494
#endif
9595
}
9696

97+
#if MICROPY_PY_UHASHLIB_SHA256
98+
#include "crypto-algorithms/sha256.c"
99+
#endif
100+
97101
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) {
98102
mp_arg_check_num(n_args, kw_args, 0, 1, false);
99103
mp_obj_hash_t *o = m_new_obj_var(mp_obj_hash_t, char, sizeof(CRYAL_SHA256_CTX));
@@ -336,8 +340,4 @@ const mp_obj_module_t mp_module_uhashlib = {
336340
.globals = (mp_obj_dict_t *)&mp_module_uhashlib_globals,
337341
};
338342

339-
#if MICROPY_PY_UHASHLIB_SHA256
340-
#include "crypto-algorithms/sha256.c"
341-
#endif
342-
343343
#endif // MICROPY_PY_UHASHLIB

extmod/moduheapq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// the algorithm here is modelled on CPython's heapq.py
1414

1515
STATIC mp_obj_list_t *get_heap(mp_obj_t heap_in) {
16-
if (!MP_OBJ_IS_TYPE(heap_in, &mp_type_list)) {
16+
if (!mp_obj_is_type(heap_in, &mp_type_list)) {
1717
mp_raise_TypeError(translate("heap must be a list"));
1818
}
1919
return MP_OBJ_TO_PTR(heap_in);

extmod/modujson.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ STATIC mp_obj_t _mod_ujson_load(mp_obj_t stream_obj, bool return_first_json) {
243243
cur = S_CUR(s);
244244
if (cur == '.' || cur == 'E' || cur == 'e') {
245245
flt = true;
246-
} else if (cur == '-' || unichar_isdigit(cur)) {
246+
} else if (cur == '+' || cur == '-' || unichar_isdigit(cur)) {
247247
// pass
248248
} else {
249249
break;

0 commit comments

Comments
 (0)