summaryrefslogtreecommitdiff
path: root/py/objtype.h
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2019-05-13 17:31:30 -0700
committerScott Shawcroft <scott@tannewt.org>2019-05-13 17:31:30 -0700
commitf29de5132562cd6e88661d150fa1ee3ab8b771e1 (patch)
tree1f3ac8c4779e4badc825d22fac3c38aceb5bb99e /py/objtype.h
parenta6785d7ff74e156c5bcfdd8f46b1cccae41cc3bf (diff)
Check native object in case of early access
If a native displayio object is accessed before it's super().__init__() has been called, then a placeholder is given that will cause a crash if accessed. This is tricky to get right so we detect this case and raise a NotInplementedError instead of crashing. Fixes #1881
Diffstat (limited to 'py/objtype.h')
-rw-r--r--py/objtype.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/py/objtype.h b/py/objtype.h
index 13613f01f..a32c87496 100644
--- a/py/objtype.h
+++ b/py/objtype.h
@@ -37,6 +37,8 @@ typedef struct _mp_obj_instance_t {
// TODO maybe cache __getattr__ and __setattr__ for efficient lookup of them
} mp_obj_instance_t;
+void mp_obj_assert_native_inited(mp_obj_t native_object);
+
#if MICROPY_CPYTHON_COMPAT
// this is needed for object.__new__
mp_obj_instance_t *mp_obj_new_instance(const mp_obj_type_t *cls, const mp_obj_type_t **native_base);