diff --git a/py/objobject.c b/py/objobject.c
index 7288ac946edb29c467cde9037d90461f7dae71c0..6150374f79061743b06395f1b2b8d01cae27b8de 100644
--- a/py/objobject.c
+++ b/py/objobject.c
@@ -59,7 +59,6 @@ STATIC mp_obj_t object___new__(mp_obj_t cls) {
 }
 STATIC MP_DEFINE_CONST_FUN_OBJ_1(object___new___fun_obj, object___new__);
 STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(object___new___obj, (const mp_obj_t)&object___new___fun_obj);
-#endif
 
 STATIC const mp_map_elem_t object_locals_dict_table[] = {
     #if MICROPY_CPYTHON_COMPAT
@@ -71,10 +70,13 @@ STATIC const mp_map_elem_t object_locals_dict_table[] = {
 };
 
 STATIC MP_DEFINE_CONST_DICT(object_locals_dict, object_locals_dict_table);
+#endif
 
 const mp_obj_type_t mp_type_object = {
     { &mp_type_type },
     .name = MP_QSTR_object,
     .make_new = object_make_new,
+    #if MICROPY_CPYTHON_COMPAT
     .locals_dict = (mp_obj_t)&object_locals_dict,
+    #endif
 };