Commit 344b7d81 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

git push origin masterMerge branch 'take-cheeze-fix_each_obj_crash'

parents 919af617 9726dbef
...@@ -119,6 +119,16 @@ os_each_object_cb(mrb_state *mrb, struct RBasic *obj, void *ud) ...@@ -119,6 +119,16 @@ os_each_object_cb(mrb_state *mrb, struct RBasic *obj, void *ud)
return; return;
} }
/* filter internal objects */
switch (obj->tt) {
case MRB_TT_ENV:
case MRB_TT_ICLASS:
return;
}
/* filter half baked (or internal) objects */
if (!obj->c) return;
/* filter class kind if target module defined */ /* filter class kind if target module defined */
if (d->target_module && !mrb_obj_is_kind_of(mrb, mrb_obj_value(obj), d->target_module)) { if (d->target_module && !mrb_obj_is_kind_of(mrb, mrb_obj_value(obj), d->target_module)) {
return; return;
......
...@@ -54,3 +54,7 @@ assert('ObjectSpace.each_object') do ...@@ -54,3 +54,7 @@ assert('ObjectSpace.each_object') do
assert_equal arys.length, arys_count assert_equal arys.length, arys_count
assert_true arys.length < objs.length assert_true arys.length < objs.length
end end
assert 'Check class pointer of ObjectSpace.each_object.' do
ObjectSpace.each_object { |obj| !obj }
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment