string.c: $; is a GC-root

* string.c (Init_String): $; must be a GC-root, not to be
  collected.  [ruby-core:79582]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-03-13 09:12:05 +00:00
parent 1933215038
commit 16e804117c
2 changed files with 12 additions and 0 deletions

View file

@ -1451,6 +1451,17 @@ CODE
assert_raise_with_message(TypeError, /\$;/) {
$; = []
}
assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
bug = '[ruby-core:79582] $; must not be GCed'
begin;
$; = " "
$a = nil
alias $; $a
alias $-F $a
GC.start
assert_equal([], "".split, bug)
end;
end
def test_split_encoding