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

ruby-changes:41962

From: nagachika <ko1@a...>
Date: Wed, 9 Mar 2016 03:35:04 +0900 (JST)
Subject: [ruby-changes:41962] nagachika:r54036 (ruby_2_2): merge revision(s) 53167: [Backport #11825]

nagachika	2016-03-09 03:34:58 +0900 (Wed, 09 Mar 2016)

  New Revision: 54036

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

  Log:
    merge revision(s) 53167: [Backport #11825]
    
    * re.c (reg_names_iter): should consider encoding of regexp.
      [ruby-core:72185] [Bug #11825]

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/re.c
    branches/ruby_2_2/test/ruby/test_regexp.rb
    branches/ruby_2_2/version.h
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 54035)
+++ ruby_2_2/version.h	(revision 54036)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.5"
-#define RUBY_RELEASE_DATE "2016-02-24"
-#define RUBY_PATCHLEVEL 241
+#define RUBY_RELEASE_DATE "2016-03-09"
+#define RUBY_PATCHLEVEL 242
 
 #define RUBY_RELEASE_YEAR 2016
-#define RUBY_RELEASE_MONTH 2
-#define RUBY_RELEASE_DAY 24
+#define RUBY_RELEASE_MONTH 3
+#define RUBY_RELEASE_DAY 9
 
 #include "ruby/version.h"
 
Index: ruby_2_2/test/ruby/test_regexp.rb
===================================================================
--- ruby_2_2/test/ruby/test_regexp.rb	(revision 54035)
+++ ruby_2_2/test/ruby/test_regexp.rb	(revision 54036)
@@ -118,13 +118,19 @@ class TestRegexp < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_regexp.rb#L118
     assert_equal(nil, Regexp.last_match(1))
     assert_equal(nil, Regexp.last_match(:foo))
 
+    bug11825_name = "\u{5b9d 77f3}"
+    bug11825_str = "\u{30eb 30d3 30fc}"
+    bug11825_re = /(?<#{bug11825_name}>)#{bug11825_str}/
+
     assert_equal(["foo", "bar"], /(?<foo>.)(?<bar>.)/.names)
     assert_equal(["foo"], /(?<foo>.)(?<foo>.)/.names)
     assert_equal([], /(.)(.)/.names)
+    assert_equal([bug11825_name], bug11825_re.names)
 
     assert_equal(["foo", "bar"], /(?<foo>.)(?<bar>.)/.match("ab").names)
     assert_equal(["foo"], /(?<foo>.)(?<foo>.)/.match("ab").names)
     assert_equal([], /(.)(.)/.match("ab").names)
+    assert_equal([bug11825_name], bug11825_re.match(bug11825_str).names)
 
     assert_equal({"foo"=>[1], "bar"=>[2]},
                  /(?<foo>.)(?<bar>.)/.named_captures)
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 54035)
+++ ruby_2_2/ChangeLog	(revision 54036)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Wed Mar  9 03:34:54 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* re.c (reg_names_iter): should consider encoding of regexp.
+	  [ruby-core:72185] [Bug #11825]
+
 Wed Feb 24 08:18:18 2016  Naohisa Goto  <ngotogenome@g...>
 
 	* enc/windows_1250.c: Should not use C++ style comments (C99 feature).
Index: ruby_2_2/re.c
===================================================================
--- ruby_2_2/re.c	(revision 54035)
+++ ruby_2_2/re.c	(revision 54036)
@@ -757,7 +757,7 @@ reg_names_iter(const OnigUChar *name, co https://github.com/ruby/ruby/blob/trunk/ruby_2_2/re.c#L757
           int back_num, int *back_refs, OnigRegex regex, void *arg)
 {
     VALUE ary = (VALUE)arg;
-    rb_ary_push(ary, rb_str_new((const char *)name, name_end-name));
+    rb_ary_push(ary, rb_enc_str_new((const char *)name, name_end-name, regex->enc));
     return 0;
 }
 

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


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

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