summaryrefslogtreecommitdiff
path: root/py/objboundmeth.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-05-11 12:10:35 +0100
committerDamien George <damien.p.george@gmail.com>2014-05-11 12:10:35 +0100
commit18ceb7055b43d158e46ff6d0a0389bc3cd05e5d5 (patch)
treef3b1ad5d9c242a8aec5c0dc58b876e6f57529f05 /py/objboundmeth.c
parenta7a1a38df43958a267410d333f495db56a8b0902 (diff)
parenteea01186547f0f1568ea1c8f002da4e33b7b0e46 (diff)
Merge branch 'master' of github.com:micropython/micropython
Diffstat (limited to 'py/objboundmeth.c')
-rw-r--r--py/objboundmeth.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/py/objboundmeth.c b/py/objboundmeth.c
index 85094add6..9bbd34e9d 100644
--- a/py/objboundmeth.c
+++ b/py/objboundmeth.c
@@ -39,6 +39,17 @@ typedef struct _mp_obj_bound_meth_t {
mp_obj_t self;
} mp_obj_bound_meth_t;
+#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED
+STATIC void bound_meth_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
+ mp_obj_bound_meth_t *o = o_in;
+ print(env, "<bound_method %p ", o);
+ mp_obj_print_helper(print, env, o->self, PRINT_REPR);
+ print(env, ".");
+ mp_obj_print_helper(print, env, o->meth, PRINT_REPR);
+ print(env, ">");
+}
+#endif
+
mp_obj_t bound_meth_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args) {
mp_obj_bound_meth_t *self = self_in;
@@ -65,6 +76,9 @@ mp_obj_t bound_meth_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_
const mp_obj_type_t bound_meth_type = {
{ &mp_type_type },
.name = MP_QSTR_bound_method,
+#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED
+ .print = bound_meth_print,
+#endif
.call = bound_meth_call,
};