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

ruby-changes:45334

From: nobu <ko1@a...>
Date: Mon, 23 Jan 2017 15:16:09 +0900 (JST)
Subject: [ruby-changes:45334] nobu:r57407 (trunk): object.c: no TypeError at Symbol

nobu	2017-01-23 15:16:04 +0900 (Mon, 23 Jan 2017)

  New Revision: 57407

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57407

  Log:
    object.c: no TypeError at Symbol
    
    * object.c (special_object_p): uninterned Symbol also should not
      raise a TypeError but return itself instead, as well as interned
      Symbols.  [ruby-core:79216] [Bug #13145]

  Modified files:
    trunk/object.c
    trunk/test/ruby/test_object.rb
Index: object.c
===================================================================
--- object.c	(revision 57406)
+++ object.c	(revision 57407)
@@ -304,6 +304,7 @@ special_object_p(VALUE obj) https://github.com/ruby/ruby/blob/trunk/object.c#L304
     switch (BUILTIN_TYPE(obj)) {
       case T_BIGNUM:
       case T_FLOAT:
+      case T_SYMBOL:
 	return TRUE;
       default:
 	return FALSE;
Index: test/ruby/test_object.rb
===================================================================
--- test/ruby/test_object.rb	(revision 57406)
+++ test/ruby/test_object.rb	(revision 57407)
@@ -23,6 +23,8 @@ class TestObject < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_object.rb#L23
     assert_equal true, true.dup
     assert_equal nil, nil.dup
     assert_equal false, false.dup
+    x = :x; assert_equal x, x.dup
+    x = "bug13145".intern; assert_equal x, x.dup
     x = 1 << 64; assert_equal x, x.dup
     x = 1.72723e-77; assert_equal x, x.dup
 
@@ -51,6 +53,8 @@ class TestObject < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_object.rb#L53
     assert_equal true, true.clone
     assert_equal nil, nil.clone
     assert_equal false, false.clone
+    x = :x; assert_equal x, x.dup
+    x = "bug13145".intern; assert_equal x, x.dup
     x = 1 << 64; assert_equal x, x.clone
     x = 1.72723e-77; assert_equal x, x.clone
     assert_raise(ArgumentError) {1.clone(freeze: false)}

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

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