"pop from empty %q"

Saves 12 bytes code on trinket m0
This commit is contained in:
Jeff Epler 2020-08-04 18:34:59 -05:00
parent 6669cedf5b
commit 93b373d617
10 changed files with 11 additions and 12 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-04 13:58-0500\n" "POT-Creation-Date: 2020-08-04 18:42-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -2894,8 +2894,7 @@ msgstr ""
#: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c
#: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c #: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c
#: shared-bindings/ps2io/Ps2.c #: shared-bindings/ps2io/Ps2.c
#, c-format msgid "pop from empty %q"
msgid "pop from empty %s"
msgstr "" msgstr ""
#: py/objint_mpz.c #: py/objint_mpz.c

View File

@ -298,7 +298,7 @@ void common_hal_pulseio_pulsein_clear(pulseio_pulsein_obj_t* self) {
uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t* self) { uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t* self) {
if (self->len == 0) { if (self->len == 0) {
mp_raise_IndexError_varg(translate("pop from empty %s"), "PulseIn"); mp_raise_IndexError_varg(translate("pop from empty %q"), MP_QSTR_PulseIn);
} }
common_hal_mcu_disable_interrupts(); common_hal_mcu_disable_interrupts();
uint16_t value = self->buffer[self->start]; uint16_t value = self->buffer[self->start];

View File

@ -160,7 +160,7 @@ void common_hal_pulseio_pulsein_clear(pulseio_pulsein_obj_t *self) {
uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t *self) { uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t *self) {
if (self->len == 0) { if (self->len == 0) {
mp_raise_IndexError_varg(translate("pop from empty %s"), "PulseIn"); mp_raise_IndexError_varg(translate("pop from empty %q"), MP_QSTR_PulseIn);
} }
common_hal_mcu_disable_interrupts(); common_hal_mcu_disable_interrupts();
uint16_t value = self->buffer[self->start]; uint16_t value = self->buffer[self->start];

View File

@ -201,7 +201,7 @@ void common_hal_pulseio_pulsein_clear(pulseio_pulsein_obj_t* self) {
uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t* self) { uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t* self) {
// if (self->len == 0) { // if (self->len == 0) {
// mp_raise_IndexError_varg(translate("pop from empty %s"), "PulseIn"); // mp_raise_IndexError_varg(translate("pop from empty %q"), MP_QSTR_PulseIn);
// } // }
// common_hal_mcu_disable_interrupts(); // common_hal_mcu_disable_interrupts();
// uint16_t value = self->buffer[self->start]; // uint16_t value = self->buffer[self->start];

View File

@ -284,7 +284,7 @@ uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t* self, int16_
uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t* self) { uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t* self) {
if (self->len == 0) { if (self->len == 0) {
mp_raise_IndexError_varg(translate("pop from empty %s"), "PulseIn"); mp_raise_IndexError_varg(translate("pop from empty %q"), MP_QSTR_PulseIn);
} }
if ( !self->paused ) { if ( !self->paused ) {

View File

@ -258,7 +258,7 @@ uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t* self, int16_
uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t* self) { uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t* self) {
if (self->len == 0) { if (self->len == 0) {
mp_raise_IndexError_varg(translate("pop from empty %s"), "PulseIn"); mp_raise_IndexError_varg(translate("pop from empty %q"), MP_QSTR_PulseIn);
} }
HAL_NVIC_DisableIRQ(self->irq); HAL_NVIC_DisableIRQ(self->irq);
uint16_t value = self->buffer[self->start]; uint16_t value = self->buffer[self->start];

View File

@ -313,7 +313,7 @@ STATIC mp_obj_t dict_popitem(mp_obj_t self_in) {
size_t cur = 0; size_t cur = 0;
mp_map_elem_t *next = dict_iter_next(self, &cur); mp_map_elem_t *next = dict_iter_next(self, &cur);
if (next == NULL) { if (next == NULL) {
mp_raise_msg_varg(&mp_type_KeyError, translate("pop from empty %s"), "dict"); mp_raise_msg_varg(&mp_type_KeyError, translate("pop from empty %q"), MP_QSTR_dict);
} }
self->map.used--; self->map.used--;
mp_obj_t items[] = {next->key, next->value}; mp_obj_t items[] = {next->key, next->value};

View File

@ -274,7 +274,7 @@ STATIC mp_obj_t list_pop(size_t n_args, const mp_obj_t *args) {
mp_check_self(MP_OBJ_IS_TYPE(args[0], &mp_type_list)); mp_check_self(MP_OBJ_IS_TYPE(args[0], &mp_type_list));
mp_obj_list_t *self = mp_instance_cast_to_native_base(args[0], &mp_type_list); mp_obj_list_t *self = mp_instance_cast_to_native_base(args[0], &mp_type_list);
if (self->len == 0) { if (self->len == 0) {
mp_raise_IndexError_varg(translate("pop from empty %s"), "list"); mp_raise_IndexError_varg(translate("pop from empty %q"), MP_QSTR_list);
} }
size_t index = mp_get_index(self->base.type, self->len, n_args == 1 ? MP_OBJ_NEW_SMALL_INT(-1) : args[1], false); size_t index = mp_get_index(self->base.type, self->len, n_args == 1 ? MP_OBJ_NEW_SMALL_INT(-1) : args[1], false);
mp_obj_t ret = self->items[index]; mp_obj_t ret = self->items[index];

View File

@ -368,7 +368,7 @@ STATIC mp_obj_t set_pop(mp_obj_t self_in) {
mp_obj_set_t *self = MP_OBJ_TO_PTR(self_in); mp_obj_set_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_t obj = mp_set_remove_first(&self->set); mp_obj_t obj = mp_set_remove_first(&self->set);
if (obj == MP_OBJ_NULL) { if (obj == MP_OBJ_NULL) {
mp_raise_msg_varg(&mp_type_KeyError, translate("pop from empty %s"), "set"); mp_raise_msg_varg(&mp_type_KeyError, translate("pop from empty %q"), MP_QSTR_set);
} }
return obj; return obj;
} }

View File

@ -133,7 +133,7 @@ STATIC mp_obj_t ps2io_ps2_obj_popleft(mp_obj_t self_in) {
int b = common_hal_ps2io_ps2_popleft(self); int b = common_hal_ps2io_ps2_popleft(self);
if (b < 0) { if (b < 0) {
mp_raise_IndexError_varg(translate("pop from empty %s"), "Ps2 buffer"); mp_raise_IndexError_varg(translate("pop from empty %q"), MP_QSTR_Ps2_space_buffer);
} }
return MP_OBJ_NEW_SMALL_INT(b); return MP_OBJ_NEW_SMALL_INT(b);
} }