ruby-changes:47951
From: nobu <ko1@a...>
Date: Sat, 30 Sep 2017 09:01:28 +0900 (JST)
Subject: [ruby-changes:47951] nobu:r60066 (trunk): string.c: fix ASCII-only on succ
nobu 2017-09-30 09:01:23 +0900 (Sat, 30 Sep 2017) New Revision: 60066 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60066 Log: string.c: fix ASCII-only on succ * string.c (str_succ): clear coderange cache when no alpha-numeric character case, carried part may become ASCII-only. [ruby-core:83062] [Bug #13952] Modified files: trunk/string.c trunk/test/ruby/test_string.rb Index: test/ruby/test_string.rb =================================================================== --- test/ruby/test_string.rb (revision 60065) +++ test/ruby/test_string.rb (revision 60066) @@ -1872,6 +1872,11 @@ CODE https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L1872 assert_equal("!", " ".succ) assert_equal("", "".succ) + + bug = '[ruby-core:83062] [Bug #13952]' + s = "\xff".b + assert_not_predicate(s, :ascii_only?) + assert_predicate(s.succ, :ascii_only?, bug) end def test_succ! Index: string.c =================================================================== --- string.c (revision 60065) +++ string.c (revision 60066) @@ -4079,6 +4079,7 @@ str_succ(VALUE str) https://github.com/ruby/ruby/blob/trunk/string.c#L4079 } carry_pos = s - sbeg; } + ENC_CODERANGE_SET(str, ENC_CODERANGE_UNKNOWN); } RESIZE_CAPA(str, slen + carry_len); sbeg = RSTRING_PTR(str); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/