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

ruby-changes:37192

From: naruse <ko1@a...>
Date: Fri, 16 Jan 2015 14:21:22 +0900 (JST)
Subject: [ruby-changes:37192] naruse:r49273 (ruby_2_2): merge revision(s) 49088: [Backport #10685]

naruse	2015-01-16 14:21:00 +0900 (Fri, 16 Jan 2015)

  New Revision: 49273

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

  Log:
    merge revision(s) 49088: [Backport #10685]
    
    * vm_args.c (keyword_hash_p): fix non-symbol keys hash.
      rb_extract_keywords() returns 0 not Qnil when no symbol keys is
      included.

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/test/ruby/test_keyword.rb
    branches/ruby_2_2/version.h
    branches/ruby_2_2/vm_args.c
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 49272)
+++ ruby_2_2/ChangeLog	(revision 49273)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Fri Jan 16 14:20:52 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* vm_args.c (keyword_hash_p): fix non-symbol keys hash.
+	  rb_extract_keywords() returns 0 not Qnil when no symbol keys is
+	  included.
+
 Fri Jan 16 11:06:17 2015  SHIBATA Hiroshi  <shibata.hiroshi@g...>
 
 	* lib/unicode_normalize.rb: typo fix. [ci skip]
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 49272)
+++ ruby_2_2/version.h	(revision 49273)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.0"
 #define RUBY_RELEASE_DATE "2015-01-16"
-#define RUBY_PATCHLEVEL 9
+#define RUBY_PATCHLEVEL 10
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 1
Index: ruby_2_2/test/ruby/test_keyword.rb
===================================================================
--- ruby_2_2/test/ruby/test_keyword.rb	(revision 49272)
+++ ruby_2_2/test/ruby/test_keyword.rb	(revision 49273)
@@ -559,4 +559,11 @@ class TestKeywordArguments < Test::Unit: https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_keyword.rb#L559
       assert_equal({:bar => "bar"}, obj.foo, bug10659)
     }
   end
+
+  def m(a) yield a end
+
+  def test_nonsymbol_key
+    result = m(["a" => 10]) { |a = nil, **b| [a, b] }
+    assert_equal([{"a" => 10}, {}], result)
+  end
 end
Index: ruby_2_2/vm_args.c
===================================================================
--- ruby_2_2/vm_args.c	(revision 49272)
+++ ruby_2_2/vm_args.c	(revision 49273)
@@ -179,7 +179,9 @@ keyword_hash_p(VALUE *kw_hash_ptr, VALUE https://github.com/ruby/ruby/blob/trunk/ruby_2_2/vm_args.c#L179
     th->mark_stack_len = msl;
 
     if (!NIL_P(*rest_hash_ptr)) {
-	*kw_hash_ptr = rb_extract_keywords(rest_hash_ptr);
+	VALUE hash = rb_extract_keywords(rest_hash_ptr);
+	if (!hash) hash = Qnil;
+	*kw_hash_ptr = hash;
 	return TRUE;
     }
     else {

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r49088


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

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