Fix wrong way to check an object is an instance of rb_cNamespace

This commit is contained in:
Satoshi Tagomori 2025-06-22 18:03:57 +09:00 committed by Satoshi Tagomori
parent 545cee083b
commit 2100826243
2 changed files with 3 additions and 2 deletions

View File

@ -40,7 +40,7 @@ struct rb_namespace_struct {
};
typedef struct rb_namespace_struct rb_namespace_t;
#define NAMESPACE_OBJ_P(obj) (CLASS_OF(obj) == rb_cNamespace)
#define NAMESPACE_OBJ_P(obj) (rb_obj_class(obj) == rb_cNamespace)
#define NAMESPACE_ROOT_P(ns) (ns && !ns->is_user)
#define NAMESPACE_USER_P(ns) (ns && ns->is_user)

View File

@ -877,7 +877,8 @@ rb_initialize_main_namespace(void)
namespace_experimental_warned = 1;
}
main_ns = rb_class_new_instance_pass_kw(0, NULL, rb_cNamespace);
main_ns = rb_class_new_instance(0, NULL, rb_cNamespace);
VM_ASSERT(NAMESPACE_OBJ_P(main_ns));
ns = rb_get_namespace_t(main_ns);
ns->ns_object = main_ns;
ns->ns_id = namespace_generate_id();