Skip to content

Commit 4d0588d

Browse files
committed
objint_longlong: Don't assert on invalid syntax, raise SyntaxError instead.
1 parent 517e170 commit 4d0588d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

py/objint_longlong.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ mp_obj_t mp_obj_new_int_from_long_str(const char *s) {
148148
char *end;
149149
// TODO: this doesn't handle Python hacked 0o octal syntax
150150
v = strtoll(s, &end, 0);
151-
assert(*end == 0);
151+
if (*end != 0) {
152+
nlr_jump(mp_obj_new_exception_msg(&mp_type_SyntaxError, "invalid syntax for number"));
153+
}
152154
mp_obj_int_t *o = m_new_obj(mp_obj_int_t);
153155
o->base.type = &int_type;
154156
o->val = v;

0 commit comments

Comments
 (0)