objsingleton: New home for Ellipsis and NotImplemented.
Having NotImplemented as MP_OBJ_SENTINEL turned out to be problematic (it needs to be checked for in a lot of places, otherwise it'll crash as would pass MP_OBJ_IS_OBJ()), so made a proper singleton value like Ellipsis, both of them sharing the same type.
This commit is contained in:
@@ -31,27 +31,6 @@
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime0.h"
|
||||
|
||||
/******************************************************************************/
|
||||
/* ellipsis object, a singleton */
|
||||
|
||||
typedef struct _mp_obj_ellipsis_t {
|
||||
mp_obj_base_t base;
|
||||
} mp_obj_ellipsis_t;
|
||||
|
||||
STATIC void ellipsis_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
|
||||
(void)self_in;
|
||||
(void)kind;
|
||||
mp_print_str(print, "Ellipsis");
|
||||
}
|
||||
|
||||
const mp_obj_type_t mp_type_ellipsis = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_Ellipsis,
|
||||
.print = ellipsis_print,
|
||||
};
|
||||
|
||||
const mp_obj_ellipsis_t mp_const_ellipsis_obj = {{&mp_type_ellipsis}};
|
||||
|
||||
/******************************************************************************/
|
||||
/* slice object */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user