commit | e53fb1bf031a53ad23a45846addf14e25cebb97d | [log] [tgz] |
---|---|---|
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | Sat May 14 15:47:08 2016 +0300 |
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | Sat May 14 15:47:08 2016 +0300 |
tree | b1fdf1d8a7028a0a1ab8d34a4dd6fd82c4fd01ff | |
parent | 2ae6697300ed6954d30d94992fc5ff13e5a93eae [diff] [blame] |
py/modstruct: Raise ValueError on unsupported format char.
diff --git a/py/modstruct.c b/py/modstruct.c index cd32097..eabc951 100644 --- a/py/modstruct.c +++ b/py/modstruct.c
@@ -120,8 +120,9 @@ if (sz == 0) { sz = (mp_uint_t)mp_binary_get_size(fmt_type, *fmt, &align); } - // TODO - assert(sz != (mp_uint_t)-1); + if (sz == 0) { + nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "unsupported format")); + } // Apply alignment size = (size + align - 1) & ~(align - 1); size += sz;