summaryrefslogtreecommitdiffstatshomepage
path: root/py/objclass.c
diff options
context:
space:
mode:
authorJohn R. Lenton <jlenton@gmail.com>2014-01-05 22:29:03 +0000
committerJohn R. Lenton <jlenton@gmail.com>2014-01-05 22:29:03 +0000
commitba3f87c94776538fece5e87ff1d7de547930397a (patch)
tree3112b328cff278168a1ef48fc37a65778ea9324a /py/objclass.c
parent6e1e98f8648d327098a03ce8d175c9854dd06cc8 (diff)
parent12e2656472bf53e467c066eda6f3e177a97210ca (diff)
downloadmicropython-ba3f87c94776538fece5e87ff1d7de547930397a.tar.gz
micropython-ba3f87c94776538fece5e87ff1d7de547930397a.zip
Merge remote-tracking branch 'upstream/master' into list_reverse
Diffstat (limited to 'py/objclass.c')
-rw-r--r--py/objclass.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/py/objclass.c b/py/objclass.c
index 203923a722..197dfa7268 100644
--- a/py/objclass.c
+++ b/py/objclass.c
@@ -6,6 +6,7 @@
#include "nlr.h"
#include "misc.h"
#include "mpconfig.h"
+#include "mpqstr.h"
#include "obj.h"
#include "runtime.h"
#include "map.h"
@@ -25,7 +26,7 @@ mp_obj_t class_call_n(mp_obj_t self_in, int n_args, const mp_obj_t *args) {
mp_obj_t o = mp_obj_new_instance(self_in);
// look for __init__ function
- mp_map_elem_t *init_fn = mp_qstr_map_lookup(self->locals, qstr_from_str_static("__init__"), false);
+ mp_map_elem_t *init_fn = mp_qstr_map_lookup(self->locals, MP_QSTR___init__, false);
if (init_fn != NULL) {
// call __init__ function
@@ -40,13 +41,13 @@ mp_obj_t class_call_n(mp_obj_t self_in, int n_args, const mp_obj_t *args) {
m_del(mp_obj_t, args2, n_args + 1);
}
if (init_ret != mp_const_none) {
- nlr_jump(mp_obj_new_exception_msg_1_arg(rt_q_TypeError, "__init__() should return None, not '%s'", mp_obj_get_type_str(init_ret)));
+ 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)));
}
} else {
// TODO
if (n_args != 0) {
- nlr_jump(mp_obj_new_exception_msg_1_arg(rt_q_TypeError, "function takes 0 positional arguments but %d were given", (void*)(machine_int_t)n_args));
+ 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));
}
}
@@ -63,6 +64,7 @@ const mp_obj_type_t class_type = {
{ &mp_const_type },
"class",
NULL, // print
+ NULL, // make_new
class_call_n, // call_n
NULL, // unary_op
NULL, // binary_op