Skip to content

Commit 14c9028

Browse files
authored
Merge pull request #7026 from dhalbert/minor-space-savings
save about 112 bytes
2 parents de95463 + 6dcbb61 commit 14c9028

File tree

10 files changed

+15
-16
lines changed

10 files changed

+15
-16
lines changed

locale/circuitpython.pot

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ msgstr ""
6060
msgid "%%c requires int or char"
6161
msgstr ""
6262

63+
#: main.c
64+
#, c-format
65+
msgid "%02X"
66+
msgstr ""
67+
6368
#: shared-bindings/rgbmatrix/RGBMatrix.c
6469
#, c-format
6570
msgid ""
@@ -2077,6 +2082,10 @@ msgstr ""
20772082
msgid "UART write"
20782083
msgstr ""
20792084

2085+
#: main.c
2086+
msgid "UID:"
2087+
msgstr ""
2088+
20802089
#: shared-module/usb_hid/Device.c
20812090
msgid "USB busy"
20822091
msgstr ""

main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -779,9 +779,9 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
779779
#if CIRCUITPY_MICROCONTROLLER && COMMON_HAL_MCU_PROCESSOR_UID_LENGTH > 0
780780
uint8_t raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH];
781781
common_hal_mcu_processor_get_uid(raw_id);
782-
mp_printf(&mp_plat_print, "UID:");
783-
for (uint8_t i = 0; i < COMMON_HAL_MCU_PROCESSOR_UID_LENGTH; i++) {
784-
mp_printf(&mp_plat_print, "%02X", raw_id[i]);
782+
mp_cprintf(&mp_plat_print, translate("UID:"));
783+
for (size_t i = 0; i < COMMON_HAL_MCU_PROCESSOR_UID_LENGTH; i++) {
784+
mp_cprintf(&mp_plat_print, translate("%02X"), raw_id[i]);
785785
}
786786
mp_printf(&mp_plat_print, "\n");
787787
port_boot_info();

ports/atmel-samd/common-hal/busio/I2C.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
125125
// exact cutoff, but no frequency well under 100kHz is available)
126126
if ((frequency < 95000) ||
127127
(i2c_m_sync_set_baudrate(&self->i2c_desc, 0, frequency / 1000) != ERR_NONE)) {
128-
reset_pin_number(sda->number);
129-
reset_pin_number(scl->number);
130128
common_hal_busio_i2c_deinit(self);
131129
mp_arg_error_invalid(MP_QSTR_frequency);
132130
}

py/modbuiltins.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,6 @@ STATIC const mp_rom_map_elem_t mp_module_builtins_globals_table[] = {
759759
{ MP_ROM_QSTR(MP_QSTR_KeyError), MP_ROM_PTR(&mp_type_KeyError) },
760760
{ MP_ROM_QSTR(MP_QSTR_LookupError), MP_ROM_PTR(&mp_type_LookupError) },
761761
{ MP_ROM_QSTR(MP_QSTR_MemoryError), MP_ROM_PTR(&mp_type_MemoryError) },
762-
{ MP_ROM_QSTR(MP_QSTR_MpyError), MP_ROM_PTR(&mp_type_MpyError) },
763762
{ MP_ROM_QSTR(MP_QSTR_NameError), MP_ROM_PTR(&mp_type_NameError) },
764763
{ MP_ROM_QSTR(MP_QSTR_NotImplementedError), MP_ROM_PTR(&mp_type_NotImplementedError) },
765764
{ MP_ROM_QSTR(MP_QSTR_OSError), MP_ROM_PTR(&mp_type_OSError) },

py/obj.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,6 @@ extern const mp_obj_type_t mp_type_ReloadException;
742742
extern const mp_obj_type_t mp_type_KeyError;
743743
extern const mp_obj_type_t mp_type_LookupError;
744744
extern const mp_obj_type_t mp_type_MemoryError;
745-
extern const mp_obj_type_t mp_type_MpyError;
746745
extern const mp_obj_type_t mp_type_NameError;
747746
extern const mp_obj_type_t mp_type_NotImplementedError;
748747
extern const mp_obj_type_t mp_type_OSError;

py/objexcept.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,6 @@ MP_DEFINE_EXCEPTION(UnicodeError, ValueError)
347347
#if CIRCUITPY_ALARM
348348
MP_DEFINE_EXCEPTION(DeepSleepRequest, BaseException)
349349
#endif
350-
MP_DEFINE_EXCEPTION(MpyError, ValueError)
351350
/*
352351
MP_DEFINE_EXCEPTION(Warning, Exception)
353352
MP_DEFINE_EXCEPTION(DeprecationWarning, Warning)

py/persistentcode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ mp_raw_code_t *mp_raw_code_load(mp_reader_t *reader) {
582582
|| MPY_FEATURE_DECODE_FLAGS(header[2]) != MPY_FEATURE_FLAGS
583583
|| header[3] > mp_small_int_bits()
584584
|| read_uint(reader, NULL) > QSTR_WINDOW_SIZE) {
585-
mp_raise_MpyError(MP_ERROR_TEXT("Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info."));
585+
mp_raise_ValueError(MP_ERROR_TEXT("Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info."));
586586
}
587587
if (MPY_FEATURE_DECODE_ARCH(header[2]) != MP_NATIVE_ARCH_NONE) {
588588
byte arch = MPY_FEATURE_DECODE_ARCH(header[2]);

py/runtime.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,10 +1742,6 @@ NORETURN void mp_raise_OverflowError_varg(const compressed_string_t *fmt, ...) {
17421742
va_end(argptr);
17431743
}
17441744

1745-
NORETURN void mp_raise_MpyError(const compressed_string_t *msg) {
1746-
mp_raise_msg(&mp_type_MpyError, msg);
1747-
}
1748-
17491745
NORETURN void mp_raise_type_arg(const mp_obj_type_t *exc_type, mp_obj_t arg) {
17501746
nlr_raise(mp_obj_new_exception_arg1(exc_type, arg));
17511747
}

py/runtime.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ NORETURN void mp_raise_BrokenPipeError(void);
225225
NORETURN void mp_raise_NotImplementedError(const compressed_string_t *msg);
226226
NORETURN void mp_raise_NotImplementedError_varg(const compressed_string_t *fmt, ...);
227227
NORETURN void mp_raise_OverflowError_varg(const compressed_string_t *fmt, ...);
228-
NORETURN void mp_raise_MpyError(const compressed_string_t *msg);
229228
NORETURN void mp_raise_recursion_depth(void);
230229
#endif
231230

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
mod0 RuntimeError Corrupt .mpy file
22
mod1 RuntimeError Corrupt .mpy file
3-
mod2 MpyError Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info.
4-
mod3 MpyError Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info.
3+
mod2 ValueError Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info.
4+
mod3 ValueError Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info.

0 commit comments

Comments
 (0)