aboutsummaryrefslogtreecommitdiff
path: root/py/obj.c
diff options
context:
space:
mode:
authorDamien George2014-11-03 16:09:39 +0000
committerDamien George2014-11-03 16:09:39 +0000
commit0344fa1ddfbe8674061fed8e904468b9bd2aa550 (patch)
tree54f4e31a21eb4722bbc07fb7d939a6364e5d2276 /py/obj.c
parent2cd79fa92484330e415cf0b400544ad90205a611 (diff)
py: Fix builtin callable so it checks user-defined instances correctly.
Addresses issue #953.
Diffstat (limited to 'py/obj.c')
-rw-r--r--py/obj.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/py/obj.c b/py/obj.c
index 0b57f24c5..02f75c7c4 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -34,6 +34,7 @@
#include "misc.h"
#include "qstr.h"
#include "obj.h"
+#include "objtype.h"
#include "mpz.h"
#include "objint.h"
#include "runtime0.h"
@@ -145,7 +146,11 @@ bool mp_obj_is_true(mp_obj_t arg) {
}
bool mp_obj_is_callable(mp_obj_t o_in) {
- return mp_obj_get_type(o_in)->call != NULL;
+ mp_call_fun_t call = mp_obj_get_type(o_in)->call;
+ if (call != mp_obj_instance_call) {
+ return call != NULL;
+ }
+ return mp_obj_instance_is_callable(o_in);
}
mp_int_t mp_obj_hash(mp_obj_t o_in) {