8000 Fix py version of struct too. · jun2sak/circuitpython@6620ac8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6620ac8

Browse files
committed
Fix py version of struct too.
1 parent 3903983 commit 6620ac8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

py/modstruct.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,11 @@ STATIC void struct_pack_into_internal(mp_obj_t fmt_in, byte *p, size_t n_args, c
214214
p += cnt;
215215
} else {
216216
while (cnt--) {
217-
mp_binary_set_val(fmt_type, *fmt, args[i], &p);
218217
// Pad bytes don't have a corresponding argument.
219-
if (*fmt != 'x') {
218+
if (*fmt == 'x') {
219+
mp_binary_set_val(fmt_type, *fmt, MP_OBJ_NEW_SMALL_INT(0), &p);
220+
} else {
221+
mp_binary_set_val(fmt_type, *fmt, args[i], &p);
220222
i++;
221223
}
222224
}

0 commit comments

Comments
 (0)
0