[前][次][番号順一覧][スレッド一覧]

ruby-changes:8307

From: matz <ko1@a...>
Date: Sat, 18 Oct 2008 19:39:55 +0900 (JST)
Subject: [ruby-changes:8307] Ruby:r19835 (trunk): * numeric.c (num_sadded): remove newly defined singleton method

matz	2008-10-18 19:39:41 +0900 (Sat, 18 Oct 2008)

  New Revision: 19835

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19835

  Log:
    * numeric.c (num_sadded): remove newly defined singleton method
      that should not exist after exception handling.  [ruby-dev:36569]

  Modified files:
    trunk/ChangeLog
    trunk/numeric.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 19834)
+++ ChangeLog	(revision 19835)
@@ -1,3 +1,8 @@
+Sat Oct 18 14:40:32 2008  Yukihiro Matsumoto  <matz@r...>
+
+	* 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@r...>
 
 	* string.c (rb_external_str_new): a new function to convert from
Index: numeric.c
===================================================================
--- numeric.c	(revision 19834)
+++ numeric.c	(revision 19835)
@@ -202,11 +202,13 @@
 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 */
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]