From 79ec15d4295e0807ae2eb42e1fcd097ba1a2664a Mon Sep 17 00:00:00 2001 From: yugui Date: Wed, 28 Oct 2009 16:11:27 +0000 Subject: merges r24684 from trunk into ruby_1_9_1. -- * vm_method.c (rb_remove_method_id): exported. * numeric.c (num_sadded): fix for non-ascii method name. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@25547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ include/ruby/intern.h | 1 + numeric.c | 6 +++--- test/ruby/test_numeric.rb | 1 + version.h | 2 +- vm_method.c | 6 ++++-- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3ea1ed8a9..23ea36957 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Aug 27 18:31:07 2009 Nobuyoshi Nakada + + * vm_method.c (rb_remove_method_id): exported. + + * numeric.c (num_sadded): fix for non-ascii method name. + Thu Aug 27 08:16:34 2009 Nobuyoshi Nakada * ext/strscan/strscan.c (strscan_set_string): set string should not be diff --git a/include/ruby/intern.h b/include/ruby/intern.h index 644423038..1bcadb195 100644 --- a/include/ruby/intern.h +++ b/include/ruby/intern.h @@ -259,6 +259,7 @@ NORETURN(void rb_exc_fatal(VALUE)); VALUE rb_f_exit(int,VALUE*); VALUE rb_f_abort(int,VALUE*); void rb_remove_method(VALUE, const char*); +void rb_remove_method_id(VALUE, ID); #define rb_disable_super(klass, name) ((void)0) #define rb_enable_super(klass, name) ((void)0) #define HAVE_RB_DEFINE_ALLOC_FUNC 1 diff --git a/numeric.c b/numeric.c index 95d16bd54..a69c2101f 100644 --- a/numeric.c +++ b/numeric.c @@ -202,13 +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)); + ID mid = 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_remove_method_id(rb_singleton_class(x), mid); rb_raise(rb_eTypeError, "can't define singleton method \"%s\" for %s", - nstr, + rb_id2name(mid), rb_obj_classname(x)); return Qnil; /* not reached */ } diff --git a/test/ruby/test_numeric.rb b/test/ruby/test_numeric.rb index 0dd7b2e99..ae389004c 100644 --- a/test/ruby/test_numeric.rb +++ b/test/ruby/test_numeric.rb @@ -47,6 +47,7 @@ class TestNumeric < Test::Unit::TestCase def test_numeric a = Numeric.new assert_raise(TypeError) { def a.foo; end } + assert_raise(TypeError) { eval("def a.\u3042; end") } assert_raise(TypeError) { a.dup } end diff --git a/version.h b/version.h index 1505403b1..9436d9819 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.1" -#define RUBY_PATCHLEVEL 305 +#define RUBY_PATCHLEVEL 306 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 diff --git a/vm_method.c b/vm_method.c index 19a8a3ebb..815de8773 100644 --- a/vm_method.c +++ b/vm_method.c @@ -301,8 +301,8 @@ rb_method_node(VALUE klass, ID id) return rb_get_method_body(klass, id, 0); } -static void -remove_method(VALUE klass, ID mid) +void +rb_remove_method_id(VALUE klass, ID mid) { st_data_t data; NODE *body = 0; @@ -344,6 +344,8 @@ remove_method(VALUE klass, ID mid) } } +#define remove_method(klass, mid) rb_remove_method_id(klass, mid) + void rb_remove_method(VALUE klass, const char *name) { -- cgit