From f325bd848b183f9b111b44e2fab2a9e6a366af3c Mon Sep 17 00:00:00 2001 From: Matt Wozniski Date: Thu, 9 May 2019 03:20:15 -0400 Subject: Use OverflowError exception type for overflows Initially I used one of the existing exception raise functions, but it's more correct and not much more code to raise OverflowError instead. --- py/runtime.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'py/runtime.c') diff --git a/py/runtime.c b/py/runtime.c index 1a75a3870..9968f26e0 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -1598,6 +1598,14 @@ NORETURN void mp_raise_NotImplementedError_varg(const compressed_string_t *fmt, nlr_raise(exception); } +NORETURN void mp_raise_OverflowError_varg(const compressed_string_t *fmt, ...) { + va_list argptr; + va_start(argptr,fmt); + mp_obj_t exception = mp_obj_new_exception_msg_vlist(&mp_type_OverflowError, fmt, argptr); + va_end(argptr); + nlr_raise(exception); +} + NORETURN void mp_raise_MpyError(const compressed_string_t *msg) { mp_raise_msg(&mp_type_MpyError, msg); } -- cgit v1.2.3