Skip to content
Snippets Groups Projects
Commit e53fb1bf authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

py/modstruct: Raise ValueError on unsupported format char.

parent 2ae66973
No related branches found
No related tags found
No related merge requests found
...@@ -120,8 +120,9 @@ STATIC mp_obj_t struct_calcsize(mp_obj_t fmt_in) { ...@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment