Skip to content

Commit 03dce05

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents 6a2ba17 + 9d95fc1 commit 03dce05

File tree

5 files changed

+29
-16
lines changed

5 files changed

+29
-16
lines changed

locale/circuitpython.pot

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ msgstr ""
205205
msgid "%q, %q, and %q must all be the same length"
206206
msgstr ""
207207

208+
#: py/objint.c
209+
msgid "%q=%q"
210+
msgstr ""
211+
208212
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
209213
#, c-format
210214
msgid "%s error 0x%x"

ports/atmel-samd/mpconfigport.mk

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,12 @@ endif
6161

6262
MICROPY_PY_ASYNC_AWAIT = 0
6363

64-
# We don't have room for the fonts for terminalio for ja and ko
64+
# We don't have room for the fonts for terminalio for certain languages,
6565
# so turn off terminalio, and if it's off and displayio is on,
6666
# force a clean build.
6767
# Note that we cannot test $(CIRCUITPY_DISPLAYIO) directly with an
6868
# ifeq, because it's not set yet.
69-
ifeq ($(TRANSLATION), ja)
70-
CIRCUITPY_TERMINALIO = 0
71-
RELEASE_NEEDS_CLEAN_BUILD = $(CIRCUITPY_DISPLAYIO)
72-
endif
73-
74-
ifeq ($(TRANSLATION), ko)
69+
ifneq (,$(filter $(TRANSLATION),ja ko ru))
7570
CIRCUITPY_TERMINALIO = 0
7671
RELEASE_NEEDS_CLEAN_BUILD = $(CIRCUITPY_DISPLAYIO)
7772
endif

ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ CIRCUITPY_ESP_FLASH_MODE = dio
1717
CIRCUITPY_ESP_FLASH_FREQ = 40m
1818
CIRCUITPY_ESP_FLASH_SIZE = 4MB
1919

20-
CIRCUITPY_PS2IO = 0
20+
OPTIMIZATION_FLAGS = -Os

ports/unix/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ INC += -I$(BUILD)
3737

3838
# compiler settings
3939
CWARN = -Wall -Werror
40-
CWARN += -Wextra -Wno-unused-parameter -Wpointer-arith -Wdouble-promotion -Wfloat-conversion
41-
CFLAGS += $(INC) $(CWARN) -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT) -I$(VARIANT_DIR) $(CFLAGS_EXTRA)
40+
CWARN += -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wpointer-arith -Wdouble-promotion -Wfloat-conversion
41+
CFLAGS += $(INC) $(CWARN) -std=gnu11 -DUNIX $(CFLAGS_MOD) $(COPT) -I$(VARIANT_DIR) $(CFLAGS_EXTRA)
4242

4343
# Debugging/Optimization
4444
ifdef DEBUG

py/objint.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -480,19 +480,33 @@ MP_DEFINE_CONST_FUN_OBJ_1(int_bit_length_obj, int_bit_length);
480480
#endif
481481

482482
// this is a classmethod
483-
STATIC mp_obj_t int_from_bytes(size_t n_args, const mp_obj_t *args) {
483+
STATIC mp_obj_t int_from_bytes(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
484484
// TODO: Support signed param (assumes signed=False at the moment)
485-
(void)n_args;
485+
486+
enum { ARG_bytes, ARG_byteorder, ARG_signed };
487+
static const mp_arg_t allowed_args[] = {
488+
{ MP_QSTR_bytes, MP_ARG_REQUIRED | MP_ARG_OBJ },
489+
{ MP_QSTR_byteorder, MP_ARG_REQUIRED | MP_ARG_OBJ },
490+
{ MP_QSTR_signed, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
491+
};
492+
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
493+
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
494+
495+
if (args[ARG_signed].u_bool) {
496+
mp_raise_NotImplementedError_varg(MP_ERROR_TEXT("%q=%q"), MP_QSTR_signed, MP_QSTR_True);
497+
}
486498

487499
// get the buffer info
488500
mp_buffer_info_t bufinfo;
489-
mp_get_buffer_raise(args[1], &bufinfo, MP_BUFFER_READ);
501+
mp_get_buffer_raise(args[ARG_bytes].u_obj, &bufinfo, MP_BUFFER_READ);
490502

491503
const byte *buf = (const byte *)bufinfo.buf;
492504
int delta = 1;
493-
if (args[2] == MP_OBJ_NEW_QSTR(MP_QSTR_little)) {
505+
if (args[ARG_byteorder].u_obj == MP_OBJ_NEW_QSTR(MP_QSTR_little)) {
494506
buf += bufinfo.len - 1;
495507
delta = -1;
508+
} else if (args[ARG_byteorder].u_obj != MP_OBJ_NEW_QSTR(MP_QSTR_big)) {
509+
mp_arg_error_invalid(MP_QSTR_byteorder);
496510
}
497511

498512
mp_uint_t value = 0;
@@ -501,15 +515,15 @@ STATIC mp_obj_t int_from_bytes(size_t n_args, const mp_obj_t *args) {
501515
#if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE
502516
if (value > (MP_SMALL_INT_MAX >> 8)) {
503517
// Result will overflow a small-int so construct a big-int
504-
return mp_obj_int_from_bytes_impl(args[2] != MP_OBJ_NEW_QSTR(MP_QSTR_little), bufinfo.len, bufinfo.buf);
518+
return mp_obj_int_from_bytes_impl(args[ARG_byteorder].u_obj != MP_OBJ_NEW_QSTR(MP_QSTR_little), bufinfo.len, bufinfo.buf);
505519
}
506520
#endif
507521
value = (value << 8) | *buf;
508522
}
509523
return mp_obj_new_int_from_uint(value);
510524
}
511525

512-
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(int_from_bytes_fun_obj, 3, 4, int_from_bytes);
526+
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(int_from_bytes_fun_obj, 3, int_from_bytes);
513527
STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(int_from_bytes_obj, MP_ROM_PTR(&int_from_bytes_fun_obj));
514528

515529
STATIC mp_obj_t int_to_bytes(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {

0 commit comments

Comments
 (0)