summaryrefslogtreecommitdiff
path: root/py/objint.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-05-28 14:51:12 +0100
committerDamien George <damien.p.george@gmail.com>2014-05-28 14:51:12 +0100
commitd1e355ea8e2a5a17ee126f5c3d173b2e6f33e460 (patch)
treed5ba59452f72a9dcc31fc6cdcf0ad8c08c8713b2 /py/objint.c
parent813ed3bda6818bd8dd15ee5e3c673a24321e740b (diff)
py: Fix check of small-int overflow when parsing ints.
Also unifies use of SMALL_INT_FITS macro across parser and runtime.
Diffstat (limited to 'py/objint.c')
-rw-r--r--py/objint.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/py/objint.c b/py/objint.c
index 7d6258b7d..f631d698f 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -35,6 +35,7 @@
#include "qstr.h"
#include "obj.h"
#include "parsenum.h"
+#include "smallint.h"
#include "mpz.h"
#include "objint.h"
#include "runtime0.h"
@@ -251,7 +252,7 @@ mp_obj_t mp_obj_new_int_from_uint(machine_uint_t value) {
}
mp_obj_t mp_obj_new_int(machine_int_t value) {
- if (MP_OBJ_FITS_SMALL_INT(value)) {
+ if (MP_SMALL_INT_FITS(value)) {
return MP_OBJ_NEW_SMALL_INT(value);
}
nlr_raise(mp_obj_new_exception_msg(&mp_type_OverflowError, "small int overflow"));