We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2ae6697 commit e53fb1bCopy full SHA for e53fb1b
1 file changed
py/modstruct.c
@@ -120,8 +120,9 @@ STATIC mp_obj_t struct_calcsize(mp_obj_t fmt_in) {
120
if (sz == 0) {
121
sz = (mp_uint_t)mp_binary_get_size(fmt_type, *fmt, &align);
122
}
123
- // TODO
124
- assert(sz != (mp_uint_t)-1);
+ if (sz == 0) {
+ nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "unsupported format"));
125
+ }
126
// Apply alignment
127
size = (size + align - 1) & ~(align - 1);
128
size += sz;
0 commit comments