Remove mp_obj_new_exception_msg_1_arg and _2_arg.
diff --git a/py/obj.h b/py/obj.h
index 48d332e..4982d5b 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -215,8 +215,6 @@
#endif
mp_obj_t mp_obj_new_exception(qstr id);
mp_obj_t mp_obj_new_exception_msg(qstr id, const char *msg);
-mp_obj_t mp_obj_new_exception_msg_1_arg(qstr id, const char *fmt, const char *a1);
-mp_obj_t mp_obj_new_exception_msg_2_args(qstr id, const char *fmt, const char *a1, const char *a2);
mp_obj_t mp_obj_new_exception_msg_varg(qstr id, const char *fmt, ...); // counts args by number of % symbols in fmt, excluding %%; can only handle void* sizes (ie no float/double!)
mp_obj_t mp_obj_new_range(int start, int stop, int step);
mp_obj_t mp_obj_new_range_iterator(int cur, int stop, int step);
diff --git a/py/objcomplex.c b/py/objcomplex.c
index 952bce1..e3dce36 100644
--- a/py/objcomplex.c
+++ b/py/objcomplex.c
@@ -66,7 +66,7 @@
}
default:
- nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "complex takes at most 2 arguments, %d given", (void*)(machine_int_t)n_args));
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "complex takes at most 2 arguments, %d given", n_args));
}
}
diff --git a/py/objexcept.c b/py/objexcept.c
index eedf05f..90e2cc7 100644
--- a/py/objexcept.c
+++ b/py/objexcept.c
@@ -48,7 +48,7 @@
mp_obj_exception_t *base = self_in;
if (n_kw != 0) {
- nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "%s does not take keyword arguments", qstr_str(base->id)));
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "%s does not take keyword arguments", qstr_str(base->id)));
}
mp_obj_exception_t *o = m_new_obj_var(mp_obj_exception_t, mp_obj_t, n_args);
@@ -75,14 +75,6 @@
return mp_obj_new_exception_msg_varg(id, msg);
}
-mp_obj_t mp_obj_new_exception_msg_1_arg(qstr id, const char *fmt, const char *a1) {
- return mp_obj_new_exception_msg_varg(id, fmt, a1);
-}
-
-mp_obj_t mp_obj_new_exception_msg_2_args(qstr id, const char *fmt, const char *a1, const char *a2) {
- return mp_obj_new_exception_msg_varg(id, fmt, a1, a2);
-}
-
mp_obj_t mp_obj_new_exception_msg_varg(qstr id, const char *fmt, ...) {
// make exception object
mp_obj_exception_t *o = m_new_obj_var(mp_obj_exception_t, mp_obj_t*, 0);
diff --git a/py/objfloat.c b/py/objfloat.c
index 309a92f..fdb8250 100644
--- a/py/objfloat.c
+++ b/py/objfloat.c
@@ -40,7 +40,7 @@
}
default:
- nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "float takes at most 1 argument, %d given", (void*)(machine_int_t)n_args));
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "float takes at most 1 argument, %d given", n_args));
}
}
diff --git a/py/objfun.c b/py/objfun.c
index b28262b..72c23a9 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -26,20 +26,19 @@
if (self->n_args_min == self->n_args_max) {
if (n_args != self->n_args_min) {
- nlr_jump(mp_obj_new_exception_msg_2_args(MP_QSTR_TypeError,
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError,
"function takes %d positional arguments but %d were given",
- (const char*)(machine_int_t)self->n_args_min,
- (const char*)(machine_int_t)n_args));
+ self->n_args_min, n_args));
}
} else {
if (n_args < self->n_args_min) {
- nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError,
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError,
"<fun name>() missing %d required positional arguments: <list of names of params>",
- (const char*)(machine_int_t)(self->n_args_min - n_args)));
+ self->n_args_min - n_args));
} else if (n_args > self->n_args_max) {
- nlr_jump(mp_obj_new_exception_msg_2_args(MP_QSTR_TypeError,
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError,
"<fun name> expected at most %d arguments, got %d",
- (void*)(machine_int_t)self->n_args_max, (void*)(machine_int_t)n_args));
+ self->n_args_max, n_args));
}
}
}
@@ -144,7 +143,7 @@
mp_obj_fun_bc_t *self = self_in;
if (n_args < self->n_args - self->n_def_args || n_args > self->n_args) {
- nlr_jump(mp_obj_new_exception_msg_2_args(MP_QSTR_TypeError, "function takes %d positional arguments but %d were given", (const char*)(machine_int_t)self->n_args, (const char*)(machine_int_t)n_args));
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "function takes %d positional arguments but %d were given", self->n_args, n_args));
}
if (n_kw != 0) {
nlr_jump(mp_obj_new_exception_msg(MP_QSTR_TypeError, "function does not take keyword arguments"));
@@ -253,7 +252,7 @@
mp_obj_fun_asm_t *self = self_in;
if (n_args != self->n_args) {
- nlr_jump(mp_obj_new_exception_msg_2_args(MP_QSTR_TypeError, "function takes %d positional arguments but %d were given", (const char*)(machine_int_t)self->n_args, (const char*)(machine_int_t)n_args));
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "function takes %d positional arguments but %d were given", self->n_args, n_args));
}
if (n_kw != 0) {
nlr_jump(mp_obj_new_exception_msg(MP_QSTR_TypeError, "function does not take keyword arguments"));
diff --git a/py/objgenerator.c b/py/objgenerator.c
index db61c08..dff4ade 100644
--- a/py/objgenerator.c
+++ b/py/objgenerator.c
@@ -28,7 +28,7 @@
const byte *bc_code;
mp_obj_fun_bc_get(self_fun, &bc_n_args, &bc_n_state, &bc_code);
if (n_args != bc_n_args) {
- nlr_jump(mp_obj_new_exception_msg_2_args(MP_QSTR_TypeError, "function takes %d positional arguments but %d were given", (const char*)(machine_int_t)bc_n_args, (const char*)(machine_int_t)n_args));
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "function takes %d positional arguments but %d were given", bc_n_args, n_args));
}
if (n_kw != 0) {
nlr_jump(mp_obj_new_exception_msg(MP_QSTR_TypeError, "function does not take keyword arguments"));
diff --git a/py/objint.c b/py/objint.c
index 2aaf267..51d3b7e 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -39,7 +39,7 @@
}
default:
- nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "int takes at most 2 arguments, %d given", (void*)(machine_int_t)n_args));
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "int takes at most 2 arguments, %d given", n_args));
}
}
diff --git a/py/objlist.c b/py/objlist.c
index b565a88..5516a08 100644
--- a/py/objlist.c
+++ b/py/objlist.c
@@ -62,7 +62,7 @@
}
default:
- nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "list takes at most 1 argument, %d given", (void*)(machine_int_t)n_args));
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "list takes at most 1 argument, %d given", n_args));
}
return NULL;
}
diff --git a/py/objset.c b/py/objset.c
index 08bcb70..3cb1929 100644
--- a/py/objset.c
+++ b/py/objset.c
@@ -67,7 +67,7 @@
}
default:
- nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "set takes at most 1 argument, %d given", (void*)(machine_int_t)n_args));
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "set takes at most 1 argument, %d given", n_args));
}
}
diff --git a/py/objtuple.c b/py/objtuple.c
index 9ca777e..f30b9a1 100644
--- a/py/objtuple.c
+++ b/py/objtuple.c
@@ -70,7 +70,7 @@
}
default:
- nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "tuple takes at most 1 argument, %d given", (void*)(machine_int_t)n_args));
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "tuple takes at most 1 argument, %d given", n_args));
}
}
diff --git a/py/objtype.c b/py/objtype.c
index 162dfd2..5b364e6 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -103,13 +103,13 @@
m_del(mp_obj_t, args2, 1 + n_args + 2 * n_kw);
}
if (init_ret != mp_const_none) {
- nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "__init__() should return None, not '%s'", mp_obj_get_type_str(init_ret)));
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "__init__() should return None, not '%s'", mp_obj_get_type_str(init_ret)));
}
} else {
// TODO
if (n_args != 0) {
- nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "function takes 0 positional arguments but %d were given", (void*)(machine_int_t)n_args));
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "function takes 0 positional arguments but %d were given", n_args));
}
}
@@ -284,7 +284,7 @@
mp_obj_type_t *self = self_in;
if (self->make_new == NULL) {
- nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "cannot create '%s' instances", self->name));
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "cannot create '%s' instances", self->name));
}
// make new instance
@@ -511,7 +511,7 @@
assert(self_in == &mp_type_staticmethod || self_in == &mp_type_classmethod);
if (n_args != 1 || n_kw != 0) {
- nlr_jump(mp_obj_new_exception_msg_1_arg(MP_QSTR_TypeError, "function takes 1 positional argument but %d were given", (void*)(machine_int_t)n_args));
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "function takes 1 positional argument but %d were given", n_args));
}
mp_obj_static_class_method_t *o = m_new_obj(mp_obj_static_class_method_t);
diff --git a/py/strtonum.c b/py/strtonum.c
index d8bb05a..74fa3d6 100644
--- a/py/strtonum.c
+++ b/py/strtonum.c
@@ -84,7 +84,7 @@
return (found ^ neg) - neg;
value_error:
- nlr_jump(mp_obj_new_exception_msg_2_args(MP_QSTR_ValueError, "invalid literal for int() with base %d: '%s'", (void*)(machine_uint_t)base, s));
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_ValueError, "invalid literal for int() with base %d: '%s'", base, s));
}
#else /* defined(UNIX) */