aboutsummaryrefslogtreecommitdiff
path: root/py/obj.h
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2020-06-22 10:21:02 +1000
committerDamien George <damien@micropython.org>2020-06-27 01:03:10 +1000
commit9f911d822ee97edaa94873823db5eb10c31f5f77 (patch)
treef09d51dcfa8481f2dce415e70b9efca9c528293b /py/obj.h
parent41fa8b5482089bdd7fa5478fe24f32913b23967c (diff)
py/objcomplex: Add mp_obj_get_complex_maybe for use in complex bin-op.
This allows complex binary operations to fail gracefully with unsupported operation rather than raising an exception, so that special methods work correctly. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/obj.h')
-rw-r--r--py/obj.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/py/obj.h b/py/obj.h
index 590b9c4b6..1fa24eb18 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -778,6 +778,7 @@ bool mp_obj_get_int_maybe(mp_const_obj_t arg, mp_int_t *value);
mp_float_t mp_obj_get_float(mp_obj_t self_in);
bool mp_obj_get_float_maybe(mp_obj_t arg, mp_float_t *value);
void mp_obj_get_complex(mp_obj_t self_in, mp_float_t *real, mp_float_t *imag);
+bool mp_obj_get_complex_maybe(mp_obj_t self_in, mp_float_t *real, mp_float_t *imag);
#endif
void mp_obj_get_array(mp_obj_t o, size_t *len, mp_obj_t **items); // *items may point inside a GC block
void mp_obj_get_array_fixed_n(mp_obj_t o, size_t len, mp_obj_t **items); // *items may point inside a GC block