ruby-changes:49336
From: nagachika <ko1@a...>
Date: Mon, 25 Dec 2017 03:46:54 +0900 (JST)
Subject: [ruby-changes:49336] nagachika:r61453 (ruby_2_4): merge revision(s) 60060: [Backport #13950]
nagachika 2017-12-25 03:46:48 +0900 (Mon, 25 Dec 2017) New Revision: 61453 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61453 Log: merge revision(s) 60060: [Backport #13950] string.c: ASCII-incompatible is not ASCII only * string.c (tr_trans): ASCII-incompatible encoding strings cannot be ASCII-only even if valid. [ruby-core:83056] [Bug #13950] Modified directories: branches/ruby_2_4/ Modified files: branches/ruby_2_4/string.c branches/ruby_2_4/test/ruby/test_string.rb branches/ruby_2_4/version.h Index: ruby_2_4/string.c =================================================================== --- ruby_2_4/string.c (revision 61452) +++ ruby_2_4/string.c (revision 61453) @@ -6520,7 +6520,7 @@ tr_trans(VALUE str, VALUE src, VALUE rep https://github.com/ruby/ruby/blob/trunk/ruby_2_4/string.c#L6520 } } - if (cr == ENC_CODERANGE_VALID) + if (cr == ENC_CODERANGE_VALID && rb_enc_asciicompat(e1)) cr = ENC_CODERANGE_7BIT; str_modify_keep_cr(str); s = RSTRING_PTR(str); send = RSTRING_END(str); Index: ruby_2_4/test/ruby/test_string.rb =================================================================== --- ruby_2_4/test/ruby/test_string.rb (revision 61452) +++ ruby_2_4/test/ruby/test_string.rb (revision 61453) @@ -1851,8 +1851,13 @@ CODE https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/ruby/test_string.rb#L1851 assert_equal(false, "\u3041\u3042".tr("\u3041", "a").ascii_only?) bug6156 = '[ruby-core:43335]' + bug13950 = '[ruby-core:83056] [Bug #13950]' str, range, star = %w[b a-z *].map{|s|s.encode("utf-16le")} - assert_equal(star, str.tr(range, star), bug6156) + result = str.tr(range, star) + assert_equal(star, result, bug6156) + assert_not_predicate(str, :ascii_only?) + assert_not_predicate(star, :ascii_only?) + assert_not_predicate(result, :ascii_only?, bug13950) end def test_tr! Index: ruby_2_4/version.h =================================================================== --- ruby_2_4/version.h (revision 61452) +++ ruby_2_4/version.h (revision 61453) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1 #define RUBY_VERSION "2.4.4" -#define RUBY_RELEASE_DATE "2017-12-24" -#define RUBY_PATCHLEVEL 223 +#define RUBY_RELEASE_DATE "2017-12-25" +#define RUBY_PATCHLEVEL 224 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 12 -#define RUBY_RELEASE_DAY 24 +#define RUBY_RELEASE_DAY 25 #include "ruby/version.h" Index: ruby_2_4 =================================================================== --- ruby_2_4 (revision 61452) +++ ruby_2_4 (revision 61453) Property changes on: ruby_2_4 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r60060 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/