summaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-18 10:39:41 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-18 10:39:41 +0000
commitc74d6f437105168fdccff179db48ef10e1a62f4d (patch)
tree2e95aed34868f7d90b70789777661cba6ce01f67 /numeric.c
parent4fa2318b6f166bb16fd21901b7027647ae953d27 (diff)
downloadruby-c74d6f437105168fdccff179db48ef10e1a62f4d.tar.gz
ruby-c74d6f437105168fdccff179db48ef10e1a62f4d.tar.xz
ruby-c74d6f437105168fdccff179db48ef10e1a62f4d.zip
* numeric.c (num_sadded): remove newly defined singleton method
that should not exist after exception handling. [ruby-dev:36569] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/numeric.c b/numeric.c
index 06351eca3..042e0c306 100644
--- a/numeric.c
+++ b/numeric.c
@@ -202,11 +202,13 @@ rb_num_coerce_relop(VALUE x, VALUE y, ID func)
static VALUE
num_sadded(VALUE x, VALUE name)
{
+ const char *nstr = rb_id2name(rb_to_id(name));
/* ruby_frame = ruby_frame->prev; */ /* pop frame for "singleton_method_added" */
/* Numerics should be values; singleton_methods should not be added to them */
+ rb_remove_method(rb_singleton_class(x), nstr);
rb_raise(rb_eTypeError,
"can't define singleton method \"%s\" for %s",
- rb_id2name(rb_to_id(name)),
+ nstr,
rb_obj_classname(x));
return Qnil; /* not reached */
}