Skip to content

Commit dfa5f8e

Browse files
committed
fix precommit complaints
1 parent b74c906 commit dfa5f8e

File tree

18 files changed

+155
-150
lines changed

18 files changed

+155
-150
lines changed

lib/littlefs/lfs2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ static int lfs2_alloc_scan(lfs2_t *lfs2) {
643643
//
644644
// note we limit the lookahead buffer to at most the amount of blocks
645645
// checkpointed, this prevents the math in lfs2_alloc from underflowing
646-
lfs2->lookahead.start = (lfs2->lookahead.start + lfs2->lookahead.next)
646+
lfs2->lookahead.start = (lfs2->lookahead.start + lfs2->lookahead.next)
647647
% lfs2->block_count;
648648
lfs2->lookahead.next = 0;
649649
lfs2->lookahead.size = lfs2_min(
@@ -5257,7 +5257,7 @@ static int lfs2_fs_grow_(lfs2_t *lfs2, lfs2_size_t block_count) {
52575257
return 0;
52585258
}
52595259

5260-
5260+
52615261
#ifndef LFS2_SHRINKNONRELOCATING
52625262
// shrinking is not supported
52635263
LFS2_ASSERT(block_count >= lfs2->block_count);

locale/circuitpython.pot

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ msgid ""
7878
"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d"
7979
msgstr ""
8080

81+
#: py/emitinlinextensa.c
82+
#, c-format
83+
msgid "%d is not a multiple of %d"
84+
msgstr ""
85+
8186
#: shared-bindings/microcontroller/Pin.c
8287
msgid "%q and %q contain duplicate pins"
8388
msgstr ""
@@ -259,10 +264,6 @@ msgstr ""
259264
msgid "%q out of range"
260265
msgstr ""
261266

262-
#: py/objmodule.c
263-
msgid "%q renamed %q"
264-
msgstr ""
265-
266267
#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c
267268
msgid "%q step cannot be zero"
268269
msgstr ""
@@ -956,6 +957,14 @@ msgstr ""
956957
msgid "ECB only operates on 16 bytes at a time"
957958
msgstr ""
958959

960+
#: py/asmxtensa.c
961+
msgid "ERROR: %q %q not word-aligned"
962+
msgstr ""
963+
964+
#: py/asmxtensa.c
965+
msgid "ERROR: xtensa %q out of range"
966+
msgstr ""
967+
959968
#: ports/espressif/common-hal/busio/SPI.c
960969
#: ports/espressif/common-hal/canio/CAN.c
961970
msgid "ESP-IDF memory allocation failed"
@@ -1020,10 +1029,6 @@ msgstr ""
10201029
msgid "Failed to buffer the sample"
10211030
msgstr ""
10221031

1023-
#: ports/zephyr-cp/common-hal/_bleio/Adapter.c
1024-
msgid "Failed to connect"
1025-
msgstr ""
1026-
10271032
#: ports/espressif/common-hal/_bleio/Adapter.c
10281033
#: ports/nordic/common-hal/_bleio/Adapter.c
10291034
#: ports/zephyr-cp/common-hal/_bleio/Adapter.c
@@ -2615,10 +2620,6 @@ msgstr ""
26152620
msgid "array/bytes required on right side"
26162621
msgstr ""
26172622

2618-
#: py/asmxtensa.c
2619-
msgid "asm overflow"
2620-
msgstr ""
2621-
26222623
#: py/compile.c
26232624
msgid "async for/with outside async function"
26242625
msgstr ""
@@ -2832,6 +2833,10 @@ msgstr ""
28322833
msgid "can't create '%q' instances"
28332834
msgstr ""
28342835

2836+
#: py/objtype.c
2837+
msgid "can't create instance"
2838+
msgstr ""
2839+
28352840
#: py/compile.c
28362841
msgid "can't declare nonlocal in outer code"
28372842
msgstr ""
@@ -2930,14 +2935,14 @@ msgstr ""
29302935
msgid "cannot convert complex type"
29312936
msgstr ""
29322937

2933-
#: py/objtype.c
2934-
msgid "cannot create instance"
2935-
msgstr ""
2936-
29372938
#: extmod/ulab/code/ndarray.c
29382939
msgid "cannot delete array elements"
29392940
msgstr ""
29402941

2942+
#: py/compile.c
2943+
msgid "cannot emit native code for this architecture"
2944+
msgstr ""
2945+
29412946
#: extmod/ulab/code/ndarray.c
29422947
msgid "cannot reshape array"
29432948
msgstr ""
@@ -3092,7 +3097,7 @@ msgstr ""
30923097
msgid "div/mod not implemented for uint"
30933098
msgstr ""
30943099

3095-
#: extmod/ulab/code/numpy/create.c
3100+
#: extmod/ulab/code/numpy/create.c py/objint_longlong.c py/objint_mpz.c
30963101
msgid "divide by zero"
30973102
msgstr ""
30983103

@@ -3476,6 +3481,10 @@ msgstr ""
34763481
msgid "interval must be in range %s-%s"
34773482
msgstr ""
34783483

3484+
#: py/emitinlinerv32.c
3485+
msgid "invalid RV32 instruction '%q'"
3486+
msgstr ""
3487+
34793488
#: py/compile.c
34803489
msgid "invalid arch"
34813490
msgstr ""
@@ -3670,6 +3679,10 @@ msgstr ""
36703679
msgid "mode must be complete, or reduced"
36713680
msgstr ""
36723681

3682+
#: py/runtime.c
3683+
msgid "module '%q' has no attribute '%q'"
3684+
msgstr ""
3685+
36733686
#: py/builtinimport.c
36743687
msgid "module not found"
36753688
msgstr ""
@@ -3718,10 +3731,6 @@ msgstr ""
37183731
msgid "native code in .mpy unsupported"
37193732
msgstr ""
37203733

3721-
#: py/asmthumb.c
3722-
msgid "native method too big"
3723-
msgstr ""
3724-
37253734
#: py/emitnative.c
37263735
msgid "native yield"
37273736
msgstr ""
@@ -3743,7 +3752,7 @@ msgstr ""
37433752
msgid "negative power with no float support"
37443753
msgstr ""
37453754

3746-
#: py/objint_mpz.c py/runtime.c
3755+
#: py/objint_longlong.c py/objint_mpz.c py/runtime.c
37473756
msgid "negative shift count"
37483757
msgstr ""
37493758

@@ -4102,6 +4111,10 @@ msgstr ""
41024111
msgid "real and imaginary parts must be of equal length"
41034112
msgstr ""
41044113

4114+
#: extmod/modre.c
4115+
msgid "regex too complex"
4116+
msgstr ""
4117+
41054118
#: py/builtinimport.c
41064119
msgid "relative import"
41074120
msgstr ""
@@ -4111,6 +4124,10 @@ msgstr ""
41114124
msgid "requested length %d but object has length %d"
41124125
msgstr ""
41134126

4127+
#: py/objint_longlong.c py/parsenum.c
4128+
msgid "result overflows long long storage"
4129+
msgstr ""
4130+
41144131
#: extmod/ulab/code/ndarray_operators.c
41154132
msgid "results cannot be cast to specified type"
41164133
msgstr ""
@@ -4375,10 +4392,6 @@ msgstr ""
43754392
msgid "type takes 1 or 3 arguments"
43764393
msgstr ""
43774394

4378-
#: py/objint_longlong.c
4379-
msgid "ulonglong too large"
4380-
msgstr ""
4381-
43824395
#: py/parse.c
43834396
msgid "unexpected indent"
43844397
msgstr ""
@@ -4400,10 +4413,6 @@ msgstr ""
44004413
msgid "unindent doesn't match any outer indent level"
44014414
msgstr ""
44024415

4403-
#: py/emitinlinerv32.c
4404-
msgid "unknown RV32 instruction '%q'"
4405-
msgstr ""
4406-
44074416
#: py/objstr.c
44084417
#, c-format
44094418
msgid "unknown conversion specifier %c"

ports/espressif/tools/update_sdkconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def sym_default(sym):
157157
default=False,
158158
help="Updates the sdkconfigs outside of the board directory.",
159159
)
160-
def update(debug, board, update_all): # noqa: C901: too complex
160+
def update(debug, board, update_all): # noqa: C901 too complex
161161
"""Updates related sdkconfig files based on the build directory version that
162162
was likely modified by menuconfig."""
163163

py/binary.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte *p
438438
val = fp_sp.i;
439439
break;
440440
}
441-
// CIRCUITPY-CHANGE
441+
// CIRCUITPY-CHANGE
442442
#if MICROPY_PY_DOUBLE_TYPECODE
443443
case 'd': {
444444
union {

py/makeversionhdr.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,6 @@ def cannot_determine_version():
2727
make fetch-tags"""
2828
)
2929

30-
with open(os.path.join(repo_path, "py", "mpconfig.h")) as f:
31-
for line in f:
32-
if line.startswith("#define MICROPY_VERSION_MAJOR "):
33-
ver_major = int(line.strip().split()[2])
34-
elif line.startswith("#define MICROPY_VERSION_MINOR "):
35-
ver_minor = int(line.strip().split()[2])
36-
elif line.startswith("#define MICROPY_VERSION_MICRO "):
37-
ver_micro = int(line.strip().split()[2])
38-
elif line.startswith("#define MICROPY_VERSION_PRERELEASE "):
39-
ver_prerelease = int(line.strip().split()[2])
40-
git_tag = "v%d.%d.%d%s" % (
41-
ver_major,
42-
ver_minor,
43-
ver_micro,
44-
"-preview" if ver_prerelease else "",
45-
)
46-
return git_tag
47-
return None
48-
4930

5031
def make_version_header(repo_path, filename):
5132
# Get version info using git (required)

py/malloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ void *m_malloc_with_finaliser(size_t num_bytes) {
145145
void *m_malloc0(size_t num_bytes) {
146146
// CIRCUITPY-CHANGE: use helper
147147
return m_malloc_helper(num_bytes,
148-
(MICROPY_GC_CONSERVATIVE_CLEAR ? 0 : M_MALLOC_ENSURE_ZEROED)
149-
| M_MALLOC_RAISE_ERROR | M_MALLOC_COLLECT);
148+
(MICROPY_GC_CONSERVATIVE_CLEAR ? 0 : M_MALLOC_ENSURE_ZEROED)
149+
| M_MALLOC_RAISE_ERROR | M_MALLOC_COLLECT);
150150
}
151151

152152
// CIRCUITPY-CHANGE: add selective collect

py/mpprint.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -599,11 +599,11 @@ int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args) {
599599
}
600600
// CIRCUITPY-CHANGE: include "0x" for 'p' and 'P'.
601601
if (fmt_chr == 'p' || fmt_chr == 'P') {
602-
#if SUPPORT_INT_BASE_PREFIX
603-
chrs += mp_print_int(print, va_arg(args, unsigned long int), 0, 16, 'a', flags | PF_FLAG_SHOW_PREFIX, fill, width);
604-
#else
605-
chrs += mp_print_strn(print, "0x", 2, flags, fill, width);
606-
#endif
602+
#if SUPPORT_INT_BASE_PREFIX
603+
chrs += mp_print_int(print, va_arg(args, unsigned long int), 0, 16, 'a', flags | PF_FLAG_SHOW_PREFIX, fill, width);
604+
#else
605+
chrs += mp_print_strn(print, "0x", 2, flags, fill, width);
606+
#endif
607607
}
608608
chrs += mp_print_int(print, val, fmt_chr == 'd', base, fmt_c, flags, fill, width);
609609
break;

py/objint_longlong.c

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const mp_obj_int_t mp_sys_maxsize_obj = {{&mp_type_int}, MP_SSIZE_MAX};
4545

4646
static void raise_long_long_overflow(void) {
4747
mp_raise_msg(&mp_type_OverflowError, MP_ERROR_TEXT("result overflows long long storage"));
48+
}
4849

4950
// CIRCUITPY-CHANGE: bit_length
5051
mp_obj_t mp_obj_int_bit_length_impl(mp_obj_t self_in) {
@@ -335,8 +336,33 @@ mp_int_t mp_obj_int_get_truncated(mp_const_obj_t self_in) {
335336
}
336337

337338
mp_int_t mp_obj_int_get_checked(mp_const_obj_t self_in) {
338-
// TODO: Check overflow
339-
return mp_obj_int_get_truncated(self_in);
339+
if (mp_obj_is_small_int(self_in)) {
340+
return MP_OBJ_SMALL_INT_VALUE(self_in);
341+
} else {
342+
const mp_obj_int_t *self = self_in;
343+
long long value = self->val;
344+
mp_int_t truncated = (mp_int_t)value;
345+
if ((long long)truncated == value) {
346+
return truncated;
347+
}
348+
}
349+
mp_raise_msg(&mp_type_OverflowError, MP_ERROR_TEXT("overflow converting long int to machine word"));
350+
}
351+
352+
mp_uint_t mp_obj_int_get_uint_checked(mp_const_obj_t self_in) {
353+
if (mp_obj_is_small_int(self_in)) {
354+
if (MP_OBJ_SMALL_INT_VALUE(self_in) >= 0) {
355+
return MP_OBJ_SMALL_INT_VALUE(self_in);
356+
}
357+
} else {
358+
const mp_obj_int_t *self = self_in;
359+
long long value = self->val;
360+
mp_uint_t truncated = (mp_uint_t)value;
361+
if (value >= 0 && (long long)truncated == value) {
362+
return truncated;
363+
}
364+
}
365+
mp_raise_msg(&mp_type_OverflowError, MP_ERROR_TEXT("overflow converting long int to machine word"));
340366
}
341367

342368
#if MICROPY_PY_BUILTINS_FLOAT

py/objlist.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ static mp_obj_t list_binary_op(mp_binary_op_t op, mp_obj_t lhs, mp_obj_t rhs) {
173173
static mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
174174
#if MICROPY_PY_BUILTINS_SLICE
175175
if (mp_obj_is_type(index, &mp_type_slice)) {
176-
// CIRCUITPY-CHANGE: handle subclassing
177-
mp_obj_list_t *self = native_list(self_in);
176+
// CIRCUITPY-CHANGE: handle subclassing
177+
mp_obj_list_t *self = native_list(self_in);
178178
mp_bound_slice_t slice;
179179
bool fast = mp_seq_get_fast_slice_indexes(self->len, index, &slice);
180180
if (value == MP_OBJ_SENTINEL) {

py/sequence.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ size_t mp_seq_multiply_len(size_t item_sz, size_t len) {
4040
if (mp_mul_mp_int_t_overflow(item_sz, len, &new_len)) {
4141
mp_raise_msg(&mp_type_OverflowError, MP_ERROR_TEXT("small int overflow"));
4242
}
43-
return (size_t) new_len;
43+
return (size_t)new_len;
4444
}
4545

4646
// Implements backend of sequence * integer operation. Assumes elements are

0 commit comments

Comments
 (0)