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.
diff --git a/py/modstruct.c b/py/modstruct.c
index 5c07b81..88411ff 100644
--- a/py/modstruct.c
+++ b/py/modstruct.c
@@ -156,9 +156,6 @@
}
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 @@
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)) {