diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | vm.c | 5 |
2 files changed, 10 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Sat Aug 21 18:54:56 2010 wanabe <s.wanabe@gmail.com> + + * vm.c (vm_define_method): copy iseq to avoid overwriting iseq->klass. + #2502, #3136. see #2420. + Sat Aug 21 17:36:42 2010 Tanaka Akira <akr@fsij.org> * ext/pathname/pathname.c (path_split): Pathname#split translated from @@ -1844,6 +1844,11 @@ vm_define_method(rb_thread_t *th, VALUE obj, ID id, VALUE iseqval, rb_iseq_t *miseq; GetISeqPtr(iseqval, miseq); + if (miseq->klass) { + iseqval = rb_iseq_clone(iseqval, 0); + GetISeqPtr(iseqval, miseq); + } + if (NIL_P(klass)) { rb_raise(rb_eTypeError, "no class/module to add method"); } |