1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* numeric.c (num_sadded): remove newly defined singleton method

that should not exist after exception handling.  [ruby-dev:36569]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-10-18 10:39:41 +00:00
parent 3f0ec8887f
commit 8705e3623c
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Sat Oct 18 14:40:32 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* numeric.c (num_sadded): remove newly defined singleton method
that should not exist after exception handling. [ruby-dev:36569]
Sat Oct 18 13:30:53 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (rb_external_str_new): a new function to convert from

View file

@ -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 */
}