Skip to content

Commit 7f189b3

Browse files
authored
Merge pull request #5747 from adafruit/7.1.x
Merge 7.1.x fixes and updates into main
2 parents 0ec839a + b2189d3 commit 7f189b3

24 files changed

+55
-35
lines changed

BUILDING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ We apply code quality checks using pre-commit. Install pre-commit once per syst
100100

101101
Activate it once per git clone with
102102

103-
pre-commit --install
103+
pre-commit install
104104

105105
Pre-commit also requires some additional programs to be installed through your package manager:
106106

ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void alarm_pin_pinalarm_reset(void) {
164164
woke_up = false;
165165
SAMD_ALARM_FLAG &= ~SAMD_ALARM_FLAG_PIN; // clear flag
166166
// Disable TAMPER interrupt
167-
RTC->MODE0.INTENCLR.bit.TAMPER = 1;
167+
RTC->MODE0.INTENCLR.reg = RTC_MODE0_INTENCLR_TAMPER;
168168
// Disable TAMPER control
169169
common_hal_mcu_disable_interrupts();
170170
RTC->MODE0.CTRLA.bit.ENABLE = 0; // Disable the RTC

ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,13 @@ static void frequencyin_reference_tc_init(void) {
185185

186186
#ifdef SAMD21
187187
tc->COUNT16.CTRLA.reg = TC_CTRLA_MODE_COUNT16 | TC_CTRLA_PRESCALER_DIV1;
188-
tc->COUNT16.INTENSET.bit.OVF = 1;
188+
tc->COUNT16.INTENSET.reg = TC_INTENSET_OVF;
189189
NVIC_EnableIRQ(TC3_IRQn + reference_tc);
190190
#endif
191191
#ifdef SAM_D5X_E5X
192192
tc->COUNT16.CTRLA.reg = TC_CTRLA_MODE_COUNT16 |
193193
TC_CTRLA_PRESCALER_DIV1;
194-
tc->COUNT16.INTENSET.bit.OVF = 1;
194+
tc->COUNT16.INTENSET.reg = TC_INTENSET_OVF;
195195
NVIC_EnableIRQ(TC0_IRQn + reference_tc);
196196
#endif
197197
}

ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ STATIC void setup_wdt(watchdog_watchdogtimer_obj_t *self, int setting) {
5858
while (WDT->SYNCBUSY.reg) { // Sync CTRL write
5959
}
6060

61-
WDT->INTENCLR.bit.EW = 1; // Disable early warning interrupt
61+
WDT->INTENCLR.reg = WDT_INTENCLR_EW; // Disable early warning interrupt
6262
WDT->CONFIG.bit.PER = setting; // Set period for chip reset
6363
WDT->CTRLA.bit.WEN = 0; // Disable window mode
6464
while (WDT->SYNCBUSY.reg) { // Sync CTRL write

py/objexcept.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ mp_obj_t mp_alloc_emergency_exception_buf(mp_obj_t size_in) {
104104
#endif
105105
#endif // MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF
106106

107-
STATIC mp_obj_exception_t *get_native_exception(mp_obj_t self_in) {
107+
mp_obj_exception_t *mp_obj_exception_get_native(mp_obj_t self_in) {
108108
assert(mp_obj_is_exception_instance(self_in));
109109
if (mp_obj_is_native_exception_instance(self_in)) {
110110
return MP_OBJ_TO_PTR(self_in);
@@ -206,7 +206,7 @@ mp_obj_t mp_obj_exception_make_new(const mp_obj_type_t *type, size_t n_args, siz
206206

207207
// Get exception "value" - that is, first argument, or None
208208
mp_obj_t mp_obj_exception_get_value(mp_obj_t self_in) {
209-
mp_obj_exception_t *self = get_native_exception(self_in);
209+
mp_obj_exception_t *self = mp_obj_exception_get_native(self_in);
210210
if (self->args->len == 0) {
211211
return mp_const_none;
212212
} else {
@@ -543,14 +543,14 @@ bool mp_obj_exception_match(mp_obj_t exc, mp_const_obj_t exc_type) {
543543
// traceback handling functions
544544

545545
void mp_obj_exception_clear_traceback(mp_obj_t self_in) {
546-
mp_obj_exception_t *self = get_native_exception(self_in);
546+
mp_obj_exception_t *self = mp_obj_exception_get_native(self_in);
547547
// just set the traceback to the empty traceback object
548548
// we don't want to call any memory management functions here
549549
self->traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj;
550550
}
551551

552552
void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, size_t line, qstr block) {
553-
mp_obj_exception_t *self = get_native_exception(self_in);
553+
mp_obj_exception_t *self = mp_obj_exception_get_native(self_in);
554554

555555
// Try to allocate memory for the traceback, with fallback to emergency traceback object
556556
if (self->traceback == NULL || self->traceback == (mp_obj_traceback_t *)&mp_const_empty_traceback_obj) {
@@ -612,7 +612,7 @@ void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, size_t line, qs
612612
}
613613

614614
void mp_obj_exception_get_traceback(mp_obj_t self_in, size_t *n, size_t **values) {
615-
mp_obj_exception_t *self = get_native_exception(self_in);
615+
mp_obj_exception_t *self = mp_obj_exception_get_native(self_in);
616616

617617
if (self->traceback == NULL) {
618618
*n = 0;

py/objexcept.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ typedef struct _mp_obj_exception_t {
3838

3939
void mp_obj_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind);
4040
void mp_obj_exception_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest);
41+
mp_obj_exception_t *mp_obj_exception_get_native(mp_obj_t self_in);
4142

4243
#define MP_DEFINE_EXCEPTION(exc_name, base_name) \
4344
const mp_obj_type_t mp_type_##exc_name = { \

shared-bindings/displayio/OnDiskBitmap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ const mp_obj_property_t displayio_ondiskbitmap_height_obj = {
138138

139139
//| pixel_shader: Union[ColorConverter, Palette]
140140
//| """The image's pixel_shader. The type depends on the underlying
141-
//| bitmap's structure. The pixel shadder can be modified (e.g., to set the
142-
//| transparent pixel or, for paletted images, to update the palette"""
141+
//| bitmap's structure. The pixel shader can be modified (e.g., to set the
142+
//| transparent pixel or, for palette shaded images, to update the palette.)"""
143143
//|
144144
STATIC mp_obj_t displayio_ondiskbitmap_obj_get_pixel_shader(mp_obj_t self_in) {
145145
displayio_ondiskbitmap_t *self = MP_OBJ_TO_PTR(self_in);

shared-bindings/keypad/__init__.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
//| """
4343
//|
4444

45-
STATIC mp_map_elem_t keypad_module_globals_table[] = {
45+
STATIC mp_rom_map_elem_t keypad_module_globals_table[] = {
4646
{ MP_ROM_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_keypad) },
4747
{ MP_ROM_QSTR(MP_QSTR_Event), MP_OBJ_FROM_PTR(&keypad_event_type) },
4848
{ MP_ROM_QSTR(MP_QSTR_EventQueue), MP_OBJ_FROM_PTR(&keypad_eventqueue_type) },
@@ -51,7 +51,7 @@ STATIC mp_map_elem_t keypad_module_globals_table[] = {
5151
{ MP_ROM_QSTR(MP_QSTR_ShiftRegisterKeys), MP_OBJ_FROM_PTR(&keypad_shiftregisterkeys_type) },
5252
};
5353

54-
STATIC MP_DEFINE_MUTABLE_DICT(keypad_module_globals, keypad_module_globals_table);
54+
STATIC MP_DEFINE_CONST_DICT(keypad_module_globals, keypad_module_globals_table);
5555

5656
const mp_obj_module_t keypad_module = {
5757
.base = { &mp_type_module },

shared-bindings/traceback/__init__.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ STATIC void traceback_exception_common(mp_print_t *print, mp_obj_t value, mp_obj
4242
if (!mp_obj_is_exception_instance(value)) {
4343
mp_raise_TypeError(translate("invalid exception"));
4444
}
45-
mp_obj_exception_t exc = *(mp_obj_exception_t *)MP_OBJ_TO_PTR(value);
4645

4746
mp_int_t limit = 0;
4847
bool print_tb = true;
@@ -51,13 +50,17 @@ STATIC void traceback_exception_common(mp_print_t *print, mp_obj_t value, mp_obj
5150
print_tb = (limit != 0);
5251
}
5352

53+
mp_obj_exception_t *exc = mp_obj_exception_get_native(value);
54+
mp_obj_traceback_t *trace_backup = exc->traceback;
55+
5456
if (tb_obj != mp_const_none && print_tb) {
55-
exc.traceback = mp_arg_validate_type(tb_obj, &mp_type_traceback, MP_QSTR_tb);
57+
exc->traceback = mp_arg_validate_type(tb_obj, &mp_type_traceback, MP_QSTR_tb);
5658
} else {
57-
exc.traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj;
59+
exc->traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj;
5860
}
5961

60-
shared_module_traceback_print_exception(&exc, print, limit);
62+
shared_module_traceback_print_exception(MP_OBJ_TO_PTR(value), print, limit);
63+
exc->traceback = trace_backup;
6164
}
6265

6366
//| def format_exception(etype: Type[BaseException], value: BaseException, tb: TracebackType,

tests/circuitpython/traceback_test.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,15 @@ def fun():
2222
traceback.print_exception(None, exc, exc.__traceback__, limit=0)
2323
print("\nLimit=-1 Trace:")
2424
traceback.print_exception(None, exc, exc.__traceback__, limit=-1)
25+
26+
27+
class NonNativeException(Exception):
28+
pass
29+
30+
31+
try:
32+
raise NonNativeException("test")
33+
except Exception as e:
34+
print("\nNonNative Trace:")
35+
traceback.print_exception(None, e, e.__traceback__)
2536
print("")

tests/circuitpython/traceback_test.py.exp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,8 @@ Traceback (most recent call last):
2121
File "circuitpython/traceback_test.py", line 9, in fun
2222
Exception: test
2323

24+
NonNative Trace:
25+
Traceback (most recent call last):
26+
File "circuitpython/traceback_test.py", line 32, in <module>
27+
NonNativeException: test
28+

tools/build_board_info.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,10 @@ def get_version_info():
160160

161161

162162
def get_current_info():
163-
response = github.get("/repos/adafruit/circuitpython-org/git/refs/heads/master")
163+
response = github.get("/repos/adafruit/circuitpython-org/git/refs/heads/main")
164164
if not response.ok:
165165
print(response.text)
166-
raise RuntimeError("cannot get master sha")
166+
raise RuntimeError("cannot get main sha")
167167
commit_sha = response.json()["object"]["sha"]
168168

169169
response = github.get(
@@ -235,7 +235,7 @@ def create_pr(changes, updated, git_info, user):
235235
pr_info = {
236236
"title": pr_title,
237237
"head": user + ":" + branch_name,
238-
"base": "master",
238+
"base": "main",
239239
"body": message,
240240
"maintainer_can_modify": True,
241241
}

tools/ci_set_matrix.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ def set_boards_to_build(build_all):
6868

6969
if not build_all:
7070
boards_to_build = set()
71-
board_pattern = re.compile(r"^ports\/[^/]+\/boards\/([^/]+)\/")
72-
port_pattern = re.compile(r"^ports\/([^/]+)\/")
71+
board_pattern = re.compile(r"^ports/[^/]+/boards/([^/]+)/")
72+
port_pattern = re.compile(r"^ports/([^/]+)/")
7373
for p in changed_files:
7474
# See if it is board specific
7575
board_matches = board_pattern.search(p)
@@ -120,7 +120,7 @@ def set_docs_to_build(build_all):
120120
doc_match = build_all
121121
if not build_all:
122122
doc_pattern = re.compile(
123-
r"^(?:docs|(?:(?:extmod\/ulab|ports\/\w+\/bindings|shared-bindings)\S+\.c|conf\.py|tools\/extract_pyi\.py|requirements-doc\.txt)$)|(?:-stubs|\.(?:md|MD|rst|RST))$"
123+
r"^(?:docs|extmod/ulab|(?:(?:ports/\w+/bindings|shared-bindings)\S+\.c|conf\.py|tools/extract_pyi\.py|requirements-doc\.txt)$)|(?:-stubs|\.(?:md|MD|rst|RST))$"
124124
)
125125
for p in changed_files:
126126
if doc_pattern.search(p):

0 commit comments

Comments
 (0)