mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-20 09:17:23 +01:00
[python] Update to MicroPython 1.9.4
This commit is contained in:
committed by
EmilieNumworks
parent
caff93cda0
commit
73250e727a
@@ -52,9 +52,12 @@ STATIC mp_obj_t object___new__(mp_obj_t cls) {
|
||||
if (!MP_OBJ_IS_TYPE(cls, &mp_type_type) || !mp_obj_is_instance_type((mp_obj_type_t*)MP_OBJ_TO_PTR(cls))) {
|
||||
mp_raise_TypeError("__new__ arg must be a user-type");
|
||||
}
|
||||
mp_obj_t o = MP_OBJ_SENTINEL;
|
||||
mp_obj_t res = mp_obj_instance_make_new(MP_OBJ_TO_PTR(cls), 1, 0, &o);
|
||||
return res;
|
||||
// This executes only "__new__" part of instance creation.
|
||||
// TODO: This won't work well for classes with native bases.
|
||||
// TODO: This is a hack, should be resolved along the lines of
|
||||
// https://github.com/micropython/micropython/issues/606#issuecomment-43685883
|
||||
const mp_obj_type_t *native_base;
|
||||
return MP_OBJ_FROM_PTR(mp_obj_new_instance(MP_OBJ_TO_PTR(cls), &native_base));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(object___new___fun_obj, object___new__);
|
||||
STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(object___new___obj, MP_ROM_PTR(&object___new___fun_obj));
|
||||
|
||||
Reference in New Issue
Block a user