Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[fix #73] should not remove the method from special constant objects …

…and symbols via instance_{eval, exec}
  • Loading branch information...
commit c1bb3960b5360ce595fdfe51ec61c93d41249d6e 1 parent c19da64
@Watson1978 Watson1978 authored
Showing with 6 additions and 2 deletions.
  1. +4 −0 vm.cpp
  2. +2 −2 vm_eval.c
View
4 vm.cpp
@@ -2812,6 +2812,10 @@ extern "C"
void
rb_vm_undef_method(Class klass, ID name, bool check)
{
+ if (NIL_P(klass)) {
+ rb_raise(rb_eTypeError, "no class to undef method");
+ }
+
const char *name_str = rb_id2name(name);
SEL sel0 = rb_vm_name_to_sel(name_str, 0);
SEL sel1 = rb_vm_name_to_sel(name_str, 1);
View
4 vm_eval.c
@@ -501,7 +501,7 @@ rb_obj_instance_eval_imp(VALUE self, SEL sel, VALUE top, int argc, VALUE *argv)
VALUE klass;
if (SPECIAL_CONST_P(self) || CLASS_OF(self) == rb_cSymbol) {
- klass = 0;
+ klass = Qnil;
}
else {
klass = rb_singleton_class(self);
@@ -541,7 +541,7 @@ rb_obj_instance_exec(VALUE self, SEL sel, int argc, VALUE *argv)
VALUE klass;
if (SPECIAL_CONST_P(self)) {
- klass = 0;
+ klass = Qnil;
}
else {
klass = rb_singleton_class(self);

0 comments on commit c1bb396

Please sign in to comment.
Something went wrong with that request. Please try again.