summaryrefslogtreecommitdiffstatshomepage
path: root/py/objtype.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-05-03 23:23:18 +0100
committerDamien George <damien.p.george@gmail.com>2015-05-04 11:08:40 +0100
commit47b9809d231c4359c56316130a76f13de2b907f7 (patch)
treeca8b6341b8e28f6c2692e92005bb8f072b14b5a3 /py/objtype.h
parent0116218fa89cc88d5d5ed7291c4f8d3412f78543 (diff)
downloadmicropython-47b9809d231c4359c56316130a76f13de2b907f7.tar.gz
micropython-47b9809d231c4359c56316130a76f13de2b907f7.zip
py: Check that arg to object.__new__ is a user-defined type.
Addresses issue #1203.
Diffstat (limited to 'py/objtype.h')
-rw-r--r--py/objtype.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/py/objtype.h b/py/objtype.h
index de1909b1e1..6023e8dfe5 100644
--- a/py/objtype.h
+++ b/py/objtype.h
@@ -44,4 +44,9 @@ void mp_obj_instance_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest);
bool mp_obj_instance_is_callable(mp_obj_t self_in);
mp_obj_t mp_obj_instance_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args);
+#define mp_obj_is_instance_type(type) ((type)->make_new == mp_obj_instance_make_new)
+#define mp_obj_is_native_type(type) ((type)->make_new != mp_obj_instance_make_new)
+// this needs to be exposed for the above macros to work correctly
+mp_obj_t mp_obj_instance_make_new(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args);
+
#endif // __MICROPY_INCLUDED_PY_OBJTYPE_H__