summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-02 15:20:24 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-02 15:20:24 +0000
commit10a0dea1f5fddd26d2b29f41fa190049eec95550 (patch)
treeb535d0fa5be1cd7445a7374bca7a0922abcc7b26
parentd064c0bf13b47356757e4dc9f678a2f0ff84e624 (diff)
* string.c (Init_String): undef Symbol#new.
* struct.c (rb_struct_s_def): wrong symbol detection. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--string.c4
-rw-r--r--struct.c11
3 files changed, 11 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 9768ae74bc..08ef7ba3bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sat Sep 2 23:59:58 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (Init_String): undef Symbol#new.
+
+ * struct.c (rb_struct_s_def): wrong symbol detection.
+
Sat Sep 2 23:59:37 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (str_to_id): a bug caused by premature optimization.
diff --git a/string.c b/string.c
index 8c167faa93..ce33f9541c 100644
--- a/string.c
+++ b/string.c
@@ -4407,7 +4407,6 @@ rb_str_setter(VALUE val, ID id, VALUE *var)
/*
* call-seq:
- * Symbol.new(str) => new_sym
* Symbol.intern(str) => new_sym
*
* Returns a new symbol corresponding to <i>str</i>.
@@ -4699,9 +4698,10 @@ Init_String(void)
rb_define_variable("$-F", &rb_fs);
rb_cSymbol = rb_define_class("Symbol", rb_cString);
+ rb_undef_alloc_func(rb_cSymbol);
+ rb_undef_method(CLASS_OF(rb_cSymbol), "new");
rb_define_singleton_method(rb_cSymbol, "all_symbols", rb_sym_all_symbols, 0); /* in parse.y */
rb_define_singleton_method(rb_cSymbol, "intern", rb_sym_s_intern, 1);
- rb_define_singleton_method(rb_cSymbol, "new", rb_sym_s_intern, 1);
rb_define_method(rb_cSymbol, "to_i", sym_to_i, 0);
rb_define_method(rb_cSymbol, "inspect", sym_inspect, 0);
diff --git a/struct.c b/struct.c
index b93f3383e9..cc09b093e8 100644
--- a/struct.c
+++ b/struct.c
@@ -282,14 +282,9 @@ rb_struct_s_def(int argc, VALUE *argv, VALUE klass)
id = rb_to_id(RARRAY_PTR(rest)[i]);
RARRAY_PTR(rest)[i] = ID2SYM(id);
}
- if (!NIL_P(name)) {
- VALUE tmp = rb_check_string_type(name);
-
- if (NIL_P(tmp)) {
- id = rb_to_id(name);
- rb_ary_unshift(rest, ID2SYM(id));
- name = Qnil;
- }
+ if (!NIL_P(name) && SYMBOL_P(name)) {
+ rb_ary_unshift(rest, name);
+ name = Qnil;
}
st = make_struct(name, rest, klass);
if (rb_block_given_p()) {