From: Eric Wong Date: 2015-12-02T01:47:16+00:00 Subject: [ruby-core:71788] Re: [Ruby trunk - Bug #11759] URI breaks with frozen strings Hi David, a new problem is to_s now returns a frozen string. This has the potential to break many existing callers of to_s. Perhaps the following (untested) one-liner is enough? --- a/lib/uri/generic.rb +++ b/lib/uri/generic.rb @@ -1339,7 +1339,7 @@ def normalize! # Constructs String from URI # def to_s - str = '' + str = ''.freeze.dup if @scheme str << @scheme str << ':'.freeze I added the extra 'freeze' instead of just calling 'dup' to avoid allocating the extra object when frozen string literals are not enabled. But yeah, problems like this is why I remain against frozen string literals for 3.0 (but I'm alright with the opt-in magic comment).