Bug #1551

String#slice! Raises RuntimeError on Frozen String Despite Making No Changes

Added by Run Paint Run Run over 6 years ago. Updated over 4 years ago.

ruby -v:ruby 1.9.2dev (2009-05-28 trunk 23601) [i686-linux] Backport:


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]:



#1 Updated by Yukihiro Matsumoto over 6 years ago

  • Status changed from Open to Closed

changed to the opposite way for consistency.


Also available in: Atom PDF