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

ruby-changes:42313

From: naruse <ko1@a...>
Date: Tue, 29 Mar 2016 17:55:04 +0900 (JST)
Subject: [ruby-changes:42313] naruse:r54387 (ruby_2_3): merge revision(s) 53366:[Backport #11884]

naruse	2016-03-29 17:54:59 +0900 (Tue, 29 Mar 2016)

  New Revision: 54387

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

  Log:
    merge revision(s) 53366:[Backport #11884]
    
    * lib/ostruct.rb (OpenStruct): make respond_to? working on
      just-allocated objects for workaround of Psych.
      [ruby-core:72501] [Bug #11884]

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/lib/ostruct.rb
    branches/ruby_2_3/test/ostruct/test_ostruct.rb
    branches/ruby_2_3/version.h
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 54386)
+++ ruby_2_3/ChangeLog	(revision 54387)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Tue Mar 29 17:54:17 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/ostruct.rb (OpenStruct): make respond_to? working on
+	  just-allocated objects for workaround of Psych.
+	  [ruby-core:72501] [Bug #11884]
+
 Tue Mar 29 17:04:35 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* vm_eval.c (rb_f_catch): [DOC] fix malformed RDoc syntax, "+...+"
Index: ruby_2_3/lib/ostruct.rb
===================================================================
--- ruby_2_3/lib/ostruct.rb	(revision 54386)
+++ ruby_2_3/lib/ostruct.rb	(revision 54387)
@@ -71,6 +71,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/lib/ostruct.rb#L71
 # of these properties compared to using a Hash or a Struct.
 #
 class OpenStruct
+  # :nodoc:
+  class << self
+    alias allocate new
+  end
+
   #
   # Creates a new OpenStruct object.  By default, the resulting OpenStruct
   # object will have no attributes.
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 54386)
+++ ruby_2_3/version.h	(revision 54387)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.0"
 #define RUBY_RELEASE_DATE "2016-03-29"
-#define RUBY_PATCHLEVEL 43
+#define RUBY_PATCHLEVEL 44
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_3/test/ostruct/test_ostruct.rb
===================================================================
--- ruby_2_3/test/ostruct/test_ostruct.rb	(revision 54386)
+++ ruby_2_3/test/ostruct/test_ostruct.rb	(revision 54387)
@@ -23,6 +23,10 @@ class TC_OpenStruct < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ostruct/test_ostruct.rb#L23
     assert_respond_to(o, :a=)
   end
 
+  def test_respond_to_allocated
+    assert_not_respond_to(OpenStruct.allocate, :a)
+  end
+
   def test_equality
     o1 = OpenStruct.new
     o2 = OpenStruct.new

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r53366


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

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