8000 Merge pull request #8281 from dhalbert/merge-micropython-v1.19.1 · lewinski/circuitpython@282e93d · GitHub
[go: up one dir, main page]

Skip to content

Commit 282e93d

Browse files
authored
Merge pull request adafruit#8281 from dhalbert/merge-micropython-v1.19.1
Merge micropython v1.19.1
2 parents 506dca7 + cb4d782 commit 282e93d

File tree

849 files changed

+13239
-10690
lines changed

Some content is hidden

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

849 files changed

+13239
-10690
lines changed

.codespell/ignore-words.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ deques
2020
extint
2121
shs
2222
pass-thru
23+
numer
24+
arithmetics
25+
ftbfs
26+
straightaway

.git-blame-ignore-revs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
#all: Reformat remaining C code that doesn't have a space after a comma.
2+
5b700b0af90591d6b1a2c087bb8de6b7f1bfdd2d
3+
4+
# ports: Reformat more C and Python source code.
5+
5c32111fa0e31e451b0f1666bdf926be2fdfd82c
6+
7+
# all: Update Python formatting to latest Black version 22.1.0.
8+
ab2923dfa1174dc177f0a90cb00a7e4ff87958d2
9+
10+
# all: Update Python formatting to latest Black version 21.12b0.
11+
3770fab33449a5dadf8eb06edfae0767e75320a6
12+
113
# tools/gen-cpydiff.py: Fix formatting of doc strings for new Black.
214
0f78c36c5aa458a954eed39a46942209107a553e
315

.github/workflows/run-tests.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ jobs:
5555
run: |
5656
make -C examples/natmod/features1
5757
make -C examples/natmod/features2
58-
make -C examples/natmod/btree
59-
make -C examples/natmod/framebuf
6058
make -C examples/natmod/uheapq
6159
make -C examples/natmod/urandom
6260
make -C examples/natmod/ure

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ litex alpha
235235
mimxrt10xx alpha
236236
nrf stable
237237
raspberrypi stable
238-
efr32 alpha
238+
silabs (efr32) alpha
239239
stm ``F4`` stable | ``others`` beta
240240
unix alpha
241241
================ ============================================================

conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ def autoapi_prepare_jinja_env(jinja_env):
441441

442442

443443
# Example configuration for intersphinx: refer to the Python standard library.
444-
intersphinx_mapping = {"cpython": ('https://docs.python.org/3/', None),
444+
intersphinx_mapping = {"python": ('https://docs.python.org/3/', None),
445445
"register": ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None),
446446
"typing": ('https://circuitpython.readthedocs.io/projects/adafruit-circuitpython-typing/en/latest/', None)}
447447

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

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -82,28 +82,23 @@ STATIC void add_generic_services(bleio_adapter_obj_t *adapter) {
8282

8383
// Generic Access Service setup.
8484

85-
bleio_uuid_obj_t *generic_access_service_uuid = m_new_obj(bleio_uuid_obj_t);
86-
generic_access_service_uuid->base.type = &bleio_uuid_type;
85+
bleio_uuid_obj_t *generic_access_service_uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type);
8786
common_hal_bleio_uuid_construct(generic_access_service_uuid, 0x1800, NULL);
8887

89-
bleio_uuid_obj_t *device_name_characteristic_uuid = m_new_obj(bleio_uuid_obj_t);
90-
device_name_characteristic_uuid->base.type = &bleio_uuid_type;
88+
bleio_uuid_obj_t *device_name_characteristic_uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type);
9189
common_hal_bleio_uuid_construct(device_name_characteristic_uuid, 0x2A00, NULL);
9290

93-
bleio_uuid_obj_t *appearance_characteristic_uuid = m_new_obj(bleio_uuid_obj_t);
94-
appearance_characteristic_uuid->base.type = &bleio_uuid_type;
91+
bleio_uuid_obj_t *appearance_characteristic_uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type);
9592
common_hal_bleio_uuid_construct(appearance_characteristic_uuid, 0x2A01, NULL);
9693

9794
// Not implemented:
9895
// Peripheral Preferred Connection Parameters
9996
// Central Address Resolution
10097

101-
bleio_service_obj_t *generic_access_service = m_new_obj(bleio_service_obj_t);
102-
generic_access_service->base.type = &bleio_service_type;
98+
bleio_service_obj_t *generic_access_service = mp_obj_malloc(bleio_service_obj_t, &bleio_service_type);
10399
common_hal_bleio_service_construct(generic_access_service, generic_access_service_uuid, false);
104100

105-
adapter->device_name_characteristic = m_new_obj(bleio_characteristic_obj_t);
106-
adapter->device_name_characteristic->base.type = &bleio_characteristic_type;
101+
adapter->device_name_characteristic = mp_obj_malloc(bleio_characteristic_obj_t, &bleio_characteristic_type);
107102

108103
char generic_name[] = { 'C', 'I', 'R', 'C', 'U', 'I', 'T', 'P', 'Y', 'n', 'n', 'n', 'n' };
109104
mp_buffer_info_t generic_name_bufinfo = {
@@ -132,8 +127,7 @@ STATIC void add_generic_services(bleio_adapter_obj_t *adapter) {
132127
.len = sizeof(zero_16),
133128
};
134129

135-
adapter->appearance_characteristic = m_new_obj(bleio_characteristic_obj_t);
136-
adapter->appearance_characteristic->base.type = &bleio_characteristic_type;
130+
adapter->appearance_characteristic = mp_obj_malloc(bleio_characteristic_obj_t, &bleio_characteristic_type);
137131

138132
common_hal_bleio_characteristic_construct(
139133
adapter->appearance_characteristic,
@@ -151,20 +145,16 @@ STATIC void add_generic_services(bleio_adapter_obj_t *adapter) {
151145

152146
// Generic Attribute Service setup.
153147

154-
bleio_uuid_obj_t *generic_attribute_service_uuid = m_new_obj(bleio_uuid_obj_t);
155-
generic_attribute_service_uuid->base.type = &bleio_uuid_type;
148+
bleio_uuid_obj_t *generic_attribute_service_uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type);
156149
common_hal_bleio_uuid_construct(generic_attribute_service_uuid, 0x1801, NULL);
157150

158-
bleio_uuid_obj_t *service_changed_characteristic_uuid = m_new_obj(bleio_uuid_obj_t);
159-
service_changed_characteristic_uuid->base.type = &bleio_uuid_type;
151+
bleio_uuid_obj_t *service_changed_characteristic_uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type);
160152
common_hal_bleio_uuid_construct(service_changed_characteristic_uuid, 0x2A05, NULL);
161153

162-
bleio_service_obj_t *generic_attribute_service = m_new_obj(bleio_service_obj_t);
163-
generic_attribute_service->base.type = &bleio_service_type;
154+
bleio_service_obj_t *generic_attribute_service = mp_obj_malloc(bleio_service_obj_t, &bleio_service_type);
164155
common_hal_bleio_service_construct(generic_attribute_service, generic_attribute_service_uuid, false);
165156

166-
adapter->service_changed_characteristic = m_new_obj(bleio_characteristic_obj_t);
167-
adapter->service_changed_characteristic->base.type = &bleio_characteristic_type;
157+
adapter->service_changed_characteristic = mp_obj_malloc(bleio_characteristic_obj_t, &bleio_characteristic_type);
168158

169159
uint32_t zero_32 = 0;
170160
mp_buffer_info_t zero_32_value = {
@@ -416,8 +406,7 @@ bleio_address_obj_t *common_hal_bleio_adapter_get_address(bleio_adapter_obj_t *s
416406
bt_addr_t addr;
417407
hci_check_error(hci_read_bd_addr(&addr));
418408

419-
bleio_address_obj_t *address = m_new_obj(bleio_address_obj_t);
420-
address->base.type = &bleio_address_type;
409+
bleio_address_obj_t *address = mp_obj_malloc(bleio_address_obj_t, &bleio_address_type);
421410

422411
common_hal_bleio_address_construct(address, addr.val, BT_ADDR_LE_PUBLIC);
423412
return address;
@@ -490,7 +479,7 @@ mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t
490479
self->scan_results = shared_module_bleio_new_scanresults(buffer_size, prefixes, prefix_length, minimum_rssi);
491480

492481
// size_t max_packet_size = extended ? BLE_GAP_SCAN_BUFFER_EXTENDED_MAX_SUPPORTED : BLE_GAP_SCAN_BUFFER_MAX;
493-
// uint8_t *raw_data = m_malloc(sizeof(ble_data_t) + max_packet_size, false);
482+
// uint8_t *raw_data = m_malloc(sizeof(ble_data_t) + max_packet_size);
494483
// ble_data_t * sd_data = (ble_data_t *) raw_data;
495484
// self->scan_results->common_hal_data = sd_data;
496485
// sd_data->len = max_packet_size;

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ void common_hal_bleio_characteristic_buffer_construct(bleio_characteristic_buffe
5555
self->characteristic = characteristic;
5656
self->timeout_ms = timeout * 1000;
5757
// This is a macro.
58-
// true means long-lived, so it won't be moved.
59-
ringbuf_alloc(&self->ringbuf, buffer_size, true);
58+
ringbuf_alloc(&self->ringbuf, buffer_size);
6059

6160
bleio_characteristic_set_observer(characteristic, self);
6261
}

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

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,7 @@ void common_hal_bleio_connection_set_connection_interval(bleio_connection_intern
453453
// for (size_t i = 0; i < response->count; ++i) {
454454
// ble_gattc_service_t *gattc_service = &response->services[i];
455455

456-
// bleio_service_obj_t *service = m_new_obj(bleio_service_obj_t);
457-
// service->base.type = &bleio_service_type;
456+
// bleio_service_obj_t *service = mp_obj_malloc(bleio_service_obj_t, &bleio_service_type);
458457

459458
// // Initialize several fields at once.
460459
// bleio_service_from_connection(service, bleio_connection_new_from_internal(connection));
@@ -466,8 +465,7 @@ void common_hal_bleio_connection_set_connection_interval(bleio_connection_intern
466465

467466
// if (gattc_service->uuid.type != BLE_UUID_TYPE_UNKNOWN) {
468467
// // Known service UUID.
469-
// bleio_uuid_obj_t *uuid = m_new_obj(bleio_uuid_obj_t);
470-
// uuid->base.type = &bleio_uuid_type;
468+
// bleio_uuid_obj_t *uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type);
471469
// bleio_uuid_construct_from_nrf_ble_uuid(uuid, &gattc_service->uuid);
472470
// service->uuid = uuid;
473471
// } else {
@@ -491,15 +489,14 @@ void common_hal_bleio_connection_set_connection_interval(bleio_connection_intern
491489
// for (size_t i = 0; i < response->count; ++i) {
492490
// ble_gattc_char_t *gattc_char = &response->chars[i];
493491

494-
// bleio_characteristic_obj_t *characteristic = m_new_obj(bleio_characteristic_obj_t);
495-
// characteristic->base.type = &bleio_characteristic_type;
492+
// bleio_characteristic_obj_t *characteristic =
493+
// mp_obj_malloc(bleio_characteristic_obj_t, &bleio_characteristic_type);
496494

497495
// bleio_uuid_obj_t *uuid = NULL;
498496

499497
// if (gattc_char->uuid.type != BLE_UUID_TYPE_UNKNOWN) {
500498
// // Known characteristic UUID.
501-
// uuid = m_new_obj(bleio_uuid_obj_t);
502-
// uuid->base.type = &bleio_uuid_type;
499+
// uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type);
503500
// bleio_uuid_construct_from_nrf_ble_uuid(uuid, &gattc_char->uuid);
504501
// } else {
505502
// // The discovery response contained a 128-bit UUID that has not yet been registered with the
@@ -557,15 +554,13 @@ void common_hal_bleio_connection_set_connection_interval(bleio_connection_intern
557554
// break;
558555
// }
559556

560-
// bleio_descriptor_obj_t *descriptor = m_new_obj(bleio_descriptor_obj_t);
561-
// descriptor->base.type = &bleio_descriptor_type;
557+
// bleio_descriptor_obj_t *descriptor = mp_obj_malloc(bleio_descriptor_obj_t, &bleio_descriptor_type);
562558

563559
// bleio_uuid_obj_t *uuid = NULL;
564560

565561
// if (gattc_desc->uuid.type != BLE_UUID_TYPE_UNKNOWN) {
566562
// // Known descriptor UUID.
567-
// uuid = m_new_obj(bleio_uuid_obj_t);
568-
// uuid->base.type = &bleio_uuid_type;
563+
// uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type);
569564
// bleio_uuid_construct_from_nrf_ble_uuid(uuid, &gattc_desc->uuid);
570565
// } else {
571566
// // The discovery response contained a 128-bit UUID that has not yet been registered with the
@@ -750,8 +745,7 @@ mp_obj_t bleio_connection_new_from_internal(bleio_connection_internal_t *interna
750745
if (internal->connection_obj != mp_const_none) {
751746
return internal->connection_obj;
752747
}
753-
bleio_connection_obj_t *connection = m_new_obj(bleio_connection_obj_t);
754-
connection->base.type = &bleio_connection_type;
748+
bleio_connection_obj_t *connection = mp_obj_malloc(bleio_connection_obj_t, &bleio_connection_type);
755749
connection->connection = internal;
756750
internal->connection_obj = connection;
757751

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void common_hal_bleio_packet_buffer_construct(
101101
}
102102

103103
if (incoming) {
104-
if (!ringbuf_alloc(&self->ringbuf, buffer_size * (sizeof(uint16_t) + max_packet_size), false)) {
104+
if (!ringbuf_alloc(&self->ringbuf, buffer_size * (sizeof(uint16_t) + max_packet_size))) {
105105
mp_raise_ValueError(translate("Buffer too large and unable to allocate"));
106106
}
107107
}
@@ -110,8 +110,8 @@ void common_hal_bleio_packet_buffer_construct(
110110
self->packet_queued = false;
111111
self->pending_index = 0;
112112
self->pending_size = 0;
113-
self->outgoing[0] = m_malloc(max_packet_size, false);
114-
self->outgoing[1] = m_malloc(max_packet_size, false);
113+
self->outgoing[0] = m_malloc(max_packet_size);
114+
self->outgoing[1] = m_malloc(max_packet_size);
115115
} else {
116116
self->outgoing[0] = NULL;
117117
self->outgoing[1] = NULL;

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ void common_hal_bleio_service_add_characteristic(bleio_service_obj_t *self,
101101

102102
if (characteristic->props & (CHAR_PROP_NOTIFY | CHAR_PROP_INDICATE)) {
103103
// We need a CCCD if this characteristic is doing notify or indicate.
104-
bleio_descriptor_obj_t *cccd = m_new_obj(bleio_descriptor_obj_t);
105-
cccd->base.type = &bleio_descriptor_type;
104+
bleio_descriptor_obj_t *cccd = mp_obj_malloc(bleio_descriptor_obj_t, &bleio_descriptor_type);
106105

107106
uint16_t zero = 0;
108107
mp_buffer_info_t zero_cccd_value = {

docs/index.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Full Table of Contents
1919
:caption: API and Usage
2020

2121
../shared-bindings/index.rst
22+
library/index.rst
2223
supported_ports.rst
2324
troubleshooting.rst
2425
libraries.rst
@@ -32,13 +33,12 @@ Full Table of Contents
3233
design_guide
3334
porting
3435
common_hal
36+
reference/mpyfiles.rst
37+
reference/glossary.rst
3538

3639
.. toctree::
3740
:maxdepth: 2
38-
:caption: MicroPython specific
39-
40-
library/index.rst
41-
reference/glossary.rst
41+
:caption: Python stand
4242

4343
.. toctree::
4444
:maxdepth: 1

docs/library/array.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
:mod:`array` -- arrays of numeric data
2-
=======================================
2+
======================================
33

44
.. module:: array
55
:synopsis: efficient arrays of numeric data
66

7-
|see_cpython_module| :mod:`cpython:array`.
7+
|see_cpython_module| :mod:`python:array`.
88

99
Supported format codes: ``b``, ``B``, ``h``, ``H``, ``i``, ``I``, ``l``,
1010
``L``, ``q``, ``Q``, ``f``, ``d`` (the latter 2 depending on the

docs/library/binascii.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
:mod:`binascii` -- binary/ASCII conversions
2-
============================================
2+
===========================================
33

44
.. module:: binascii
55
:synopsis: binary/ASCII conversions
66

7-
|see_cpython_module| :mod:`cpython:binascii`.
7+
|see_cpython_module| :mod:`python:binascii`.
88

99
This module implements conversions between binary data and various
1010
encodings of it in ASCII form (in both directions).
@@ -31,11 +31,11 @@ Functions
3131
Conforms to `RFC 2045 s.6.8 <https://tools.ietf.org/html/rfc2045#section-6.8>`_.
3232
Returns a bytes object.
3333

34-
.. function:: b2a_base64(data)
34+
.. function:: b2a_base64(data, *, newline=True)
3535

3636
Encode binary data in base64 format, as in `RFC 3548
3737
<https://tools.ietf.org/html/rfc3548.html>`_. Returns the encoded data
38-
followed by a newline character, as a bytes object.
38+
followed by a newline character if ``newline`` is true, as a bytes object.
3939

4040
.. function:: crc32(data, value=0, /)
4141

0 commit comments

Comments
 (0)
0