Merge pull request #5747 from adafruit/7.1.x

Merge 7.1.x fixes and updates into main
This commit is contained in:
Jeff Epler 2021-12-17 20:44:43 -07:00 committed by GitHub
commit 7f189b3e30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 55 additions and 35 deletions

View File

@ -100,7 +100,7 @@ We apply code quality checks using pre-commit. Install pre-commit once per syst
Activate it once per git clone with
pre-commit --install
pre-commit install
Pre-commit also requires some additional programs to be installed through your package manager:

@ -1 +1 @@
Subproject commit c03990cc56283417e752246c2738199f65d1b7ef
Subproject commit a99e0b98787266369eaa33bdae271de761eca05b

@ -1 +1 @@
Subproject commit 781f46b73f71817b709d2e279fc188a7c1e69423
Subproject commit 434e367cc7da4c2836affdbf92b8932ca59a25b0

@ -1 +1 @@
Subproject commit 92a6ce1da70c0c4f69ef34fc0d7ec7155cc2441f
Subproject commit 4fc5a32763c4a6eac3a9446e296a9e925cc29a5c

@ -1 +1 @@
Subproject commit 313c17cbb590ef8d505845369eb3b78c25c97fae
Subproject commit bafa35c18a610660bdce68784195c4a7fbdf1189

@ -1 +1 @@
Subproject commit e25c1801c5428598f543873bb846851b78efb329
Subproject commit de4829a027a45882ae5477e50a75985e0e59f759

@ -1 +1 @@
Subproject commit ed41dd44605110f1d1411ed694ec2b5676dd8d9c
Subproject commit 8fc5eaecb3e24e4109bcc788f41461f1c45c3719

@ -1 +1 @@
Subproject commit daff8cdca78637915bea2f3a120cc84578516195
Subproject commit ebbe69667d53ae76bc6d82e5296f87520ffbb5ae

@ -1 +1 @@
Subproject commit e4f7cd083dea8eb103954e7703bbb487491b433f
Subproject commit 4ac43288938abb4c3db127eeb79ef0d4ea4c16ea

@ -1 +1 @@
Subproject commit 70ef86dc1a42138efcab01945d5a421e45f2408e
Subproject commit 9ac490905834466319279a3390c914f1fd83733f

@ -1 +1 @@
Subproject commit 379209dd7e4374c262b84256778d7895693e7fb6
Subproject commit 0df4521b4a04ca1236960ff889ede118ec4305b5

@ -1 +1 @@
Subproject commit 5b699a609197fb42aa059788c7c824c346d57c4e
Subproject commit 755784b6acc8ba419a085bee2d2dc4374f0d0030

View File

@ -164,7 +164,7 @@ void alarm_pin_pinalarm_reset(void) {
woke_up = false;
SAMD_ALARM_FLAG &= ~SAMD_ALARM_FLAG_PIN; // clear flag
// Disable TAMPER interrupt
RTC->MODE0.INTENCLR.bit.TAMPER = 1;
RTC->MODE0.INTENCLR.reg = RTC_MODE0_INTENCLR_TAMPER;
// Disable TAMPER control
common_hal_mcu_disable_interrupts();
RTC->MODE0.CTRLA.bit.ENABLE = 0; // Disable the RTC

View File

@ -185,13 +185,13 @@ static void frequencyin_reference_tc_init(void) {
#ifdef SAMD21
tc->COUNT16.CTRLA.reg = TC_CTRLA_MODE_COUNT16 | TC_CTRLA_PRESCALER_DIV1;
tc->COUNT16.INTENSET.bit.OVF = 1;
tc->COUNT16.INTENSET.reg = TC_INTENSET_OVF;
NVIC_EnableIRQ(TC3_IRQn + reference_tc);
#endif
#ifdef SAM_D5X_E5X
tc->COUNT16.CTRLA.reg = TC_CTRLA_MODE_COUNT16 |
TC_CTRLA_PRESCALER_DIV1;
tc->COUNT16.INTENSET.bit.OVF = 1;
tc->COUNT16.INTENSET.reg = TC_INTENSET_OVF;
NVIC_EnableIRQ(TC0_IRQn + reference_tc);
#endif
}

View File

@ -58,7 +58,7 @@ STATIC void setup_wdt(watchdog_watchdogtimer_obj_t *self, int setting) {
while (WDT->SYNCBUSY.reg) { // Sync CTRL write
}
WDT->INTENCLR.bit.EW = 1; // Disable early warning interrupt
WDT->INTENCLR.reg = WDT_INTENCLR_EW; // Disable early warning interrupt
WDT->CONFIG.bit.PER = setting; // Set period for chip reset
WDT->CTRLA.bit.WEN = 0; // Disable window mode
while (WDT->SYNCBUSY.reg) { // Sync CTRL write

View File

@ -104,7 +104,7 @@ mp_obj_t mp_alloc_emergency_exception_buf(mp_obj_t size_in) {
#endif
#endif // MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF
STATIC mp_obj_exception_t *get_native_exception(mp_obj_t self_in) {
mp_obj_exception_t *mp_obj_exception_get_native(mp_obj_t self_in) {
assert(mp_obj_is_exception_instance(self_in));
if (mp_obj_is_native_exception_instance(self_in)) {
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
// Get exception "value" - that is, first argument, or None
mp_obj_t mp_obj_exception_get_value(mp_obj_t self_in) {
mp_obj_exception_t *self = get_native_exception(self_in);
mp_obj_exception_t *self = mp_obj_exception_get_native(self_in);
if (self->args->len == 0) {
return mp_const_none;
} else {
@ -543,14 +543,14 @@ bool mp_obj_exception_match(mp_obj_t exc, mp_const_obj_t exc_type) {
// traceback handling functions
void mp_obj_exception_clear_traceback(mp_obj_t self_in) {
mp_obj_exception_t *self = get_native_exception(self_in);
mp_obj_exception_t *self = mp_obj_exception_get_native(self_in);
// just set the traceback to the empty traceback object
// we don't want to call any memory management functions here
self->traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj;
}
void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, size_t line, qstr block) {
mp_obj_exception_t *self = get_native_exception(self_in);
mp_obj_exception_t *self = mp_obj_exception_get_native(self_in);
// Try to allocate memory for the traceback, with fallback to emergency traceback object
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
}
void mp_obj_exception_get_traceback(mp_obj_t self_in, size_t *n, size_t **values) {
mp_obj_exception_t *self = get_native_exception(self_in);
mp_obj_exception_t *self = mp_obj_exception_get_native(self_in);
if (self->traceback == NULL) {
*n = 0;

View File

@ -38,6 +38,7 @@ typedef struct _mp_obj_exception_t {
void mp_obj_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind);
void mp_obj_exception_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest);
mp_obj_exception_t *mp_obj_exception_get_native(mp_obj_t self_in);
#define MP_DEFINE_EXCEPTION(exc_name, base_name) \
const mp_obj_type_t mp_type_##exc_name = { \

View File

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

View File

@ -42,7 +42,7 @@
//| """
//|
STATIC mp_map_elem_t keypad_module_globals_table[] = {
STATIC mp_rom_map_elem_t keypad_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_keypad) },
{ MP_ROM_QSTR(MP_QSTR_Event), MP_OBJ_FROM_PTR(&keypad_event_type) },
{ 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[] = {
{ MP_ROM_QSTR(MP_QSTR_ShiftRegisterKeys), MP_OBJ_FROM_PTR(&keypad_shiftregisterkeys_type) },
};
STATIC MP_DEFINE_MUTABLE_DICT(keypad_module_globals, keypad_module_globals_table);
STATIC MP_DEFINE_CONST_DICT(keypad_module_globals, keypad_module_globals_table);
const mp_obj_module_t keypad_module = {
.base = { &mp_type_module },

View File

@ -42,7 +42,6 @@ STATIC void traceback_exception_common(mp_print_t *print, mp_obj_t value, mp_obj
if (!mp_obj_is_exception_instance(value)) {
mp_raise_TypeError(translate("invalid exception"));
}
mp_obj_exception_t exc = *(mp_obj_exception_t *)MP_OBJ_TO_PTR(value);
mp_int_t limit = 0;
bool print_tb = true;
@ -51,13 +50,17 @@ STATIC void traceback_exception_common(mp_print_t *print, mp_obj_t value, mp_obj
print_tb = (limit != 0);
}
mp_obj_exception_t *exc = mp_obj_exception_get_native(value);
mp_obj_traceback_t *trace_backup = exc->traceback;
if (tb_obj != mp_const_none && print_tb) {
exc.traceback = mp_arg_validate_type(tb_obj, &mp_type_traceback, MP_QSTR_tb);
exc->traceback = mp_arg_validate_type(tb_obj, &mp_type_traceback, MP_QSTR_tb);
} else {
exc.traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj;
exc->traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj;
}
shared_module_traceback_print_exception(&exc, print, limit);
shared_module_traceback_print_exception(MP_OBJ_TO_PTR(value), print, limit);
exc->traceback = trace_backup;
}
//| def format_exception(etype: Type[BaseException], value: BaseException, tb: TracebackType,

View File

@ -22,4 +22,15 @@ except Exception as exc:
traceback.print_exception(None, exc, exc.__traceback__, limit=0)
print("\nLimit=-1 Trace:")
traceback.print_exception(None, exc, exc.__traceback__, limit=-1)
class NonNativeException(Exception):
pass
try:
raise NonNativeException("test")
except Exception as e:
print("\nNonNative Trace:")
traceback.print_exception(None, e, e.__traceback__)
print("")

View File

@ -21,3 +21,8 @@ Traceback (most recent call last):
File "circuitpython/traceback_test.py", line 9, in fun
Exception: test
NonNative Trace:
Traceback (most recent call last):
File "circuitpython/traceback_test.py", line 32, in <module>
NonNativeException: test

View File

@ -160,10 +160,10 @@ def get_version_info():
def get_current_info():
response = github.get("/repos/adafruit/circuitpython-org/git/refs/heads/master")
response = github.get("/repos/adafruit/circuitpython-org/git/refs/heads/main")
if not response.ok:
print(response.text)
raise RuntimeError("cannot get master sha")
raise RuntimeError("cannot get main sha")
commit_sha = response.json()["object"]["sha"]
response = github.get(
@ -235,7 +235,7 @@ def create_pr(changes, updated, git_info, user):
pr_info = {
"title": pr_title,
"head": user + ":" + branch_name,
"base": "master",
"base": "main",
"body": message,
"maintainer_can_modify": True,
}

View File

@ -68,8 +68,8 @@ def set_boards_to_build(build_all):
if not build_all:
boards_to_build = set()
board_pattern = re.compile(r"^ports\/[^/]+\/boards\/([^/]+)\/")
port_pattern = re.compile(r"^ports\/([^/]+)\/")
board_pattern = re.compile(r"^ports/[^/]+/boards/([^/]+)/")
port_pattern = re.compile(r"^ports/([^/]+)/")
for p in changed_files:
# See if it is board specific
board_matches = board_pattern.search(p)
@ -120,7 +120,7 @@ def set_docs_to_build(build_all):
doc_match = build_all
if not build_all:
doc_pattern = re.compile(
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))$"
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))$"
)
for p in changed_files:
if doc_pattern.search(p):