diff --git a/struct.c b/struct.c index 9d89134392..0afc0a9774 100644 --- a/struct.c +++ b/struct.c @@ -148,16 +148,19 @@ rb_struct_modify(VALUE s) static VALUE rb_struct_set(VALUE obj, VALUE val) { - VALUE members, slot; + VALUE members, slot, fsym; long i, len; ID fid = rb_frame_this_func(); members = rb_struct_members(obj); len = RARRAY_LEN(members); rb_struct_modify(obj); + fid = rb_id_attrget(fid); + if (!fid) not_a_member(rb_frame_this_func()); + fsym = ID2SYM(fid); for (i=0; i