Skip to content
Snippets Groups Projects
Commit dffa383b authored by Damien George's avatar Damien George
Browse files

py/modstruct: Remove unreachable code, and add comment about CPy diff.

The deleted code is unreachable because calcsize_items guarantees that
num_items corresponds to how many items there are in fmt to unpack.
parent 9fdba0e0
No related branches found
No related tags found
No related merge requests found
......@@ -156,9 +156,6 @@ STATIC mp_obj_t struct_unpack_from(size_t n_args, const mp_obj_t *args) {
}
for (uint i = 0; i < num_items;) {
if (*fmt == '\0') {
break;
}
mp_uint_t sz = 1;
if (unichar_isdigit(*fmt)) {
sz = get_fmt_num(&fmt);
......@@ -191,6 +188,7 @@ STATIC void struct_pack_into_internal(mp_obj_t fmt_in, byte *p, byte* end_p, siz
for (i = 0; i < n_args;) {
mp_uint_t sz = 1;
if (*fmt == '\0') {
// more arguments given than used by format string; CPython raises struct.error here
break;
}
if (unichar_isdigit(*fmt)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment