py/modstruct: Raise ValueError on unsupported format char.
This commit is contained in:
parent
2ae6697300
commit
e53fb1bf03
|
@ -120,8 +120,9 @@ STATIC mp_obj_t struct_calcsize(mp_obj_t fmt_in) {
|
||||||
if (sz == 0) {
|
if (sz == 0) {
|
||||||
sz = (mp_uint_t)mp_binary_get_size(fmt_type, *fmt, &align);
|
sz = (mp_uint_t)mp_binary_get_size(fmt_type, *fmt, &align);
|
||||||
}
|
}
|
||||||
// TODO
|
if (sz == 0) {
|
||||||
assert(sz != (mp_uint_t)-1);
|
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "unsupported format"));
|
||||||
|
}
|
||||||
// Apply alignment
|
// Apply alignment
|
||||||
size = (size + align - 1) & ~(align - 1);
|
size = (size + align - 1) & ~(align - 1);
|
||||||
size += sz;
|
size += sz;
|
||||||
|
|
Loading…
Reference in New Issue