Actions
Bug #1551
closedString#slice! Raises RuntimeError on Frozen String Despite Making No Changes
Description
=begin
On 1.9.2 and 1.9.1 calling String#slice! on a frozen string causes a RuntimeError to be raised even if the method wouldn't have changed the string. This behavior is inconsistent with other operations on frozen strings, and a regression from 1.8.7, on which no exception is raised in this scenario.
The following examples all raise RuntimeErrors on ruby 1.9.2dev (2009-05-28 trunk 23601) [i686-linux]:
"ruby".freeze.slice!(10)
"ruby".freeze.slice!(10,3)
"ruby".freeze.slice!(4,-3)
"ruby".freeze.slice!(10..20)
"ruby".freeze.slice!(/x/)
=end
Actions
Like0
Like0