Project

General

Profile

Bug #12031

Make ERB work with --enable-frozen-string-literal

Added by jeremyevans0 (Jeremy Evans) almost 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.0dev (2016-01-26) [i386-openbsd]
[ruby-core:73561]

Description

ERB currently does not work with --enable-frozen-string-literal:

$ echo "a" | RUBYOPT=--enable-frozen-string-literal erb
-:1:in `concat': can't modify frozen String (RuntimeError)
        from -:1:in `<main>'
        from /usr/local/lib/ruby/2.3/erb.rb:864:in `eval'
        from /usr/local/lib/ruby/2.3/erb.rb:864:in `result'
        from /usr/local/lib/ruby/2.3/erb.rb:846:in `run'
        from /usr/local/bin/erb23:149:in `run'
        from /usr/local/bin/erb23:170:in `<main>'

The attached patch makes it work with --enable-frozen-string-literal:

$ echo "a" | RUBYOPT=--enable-frozen-string-literal RUBYLIB=~/ruby/lib erb
a

Associated revisions

Revision 53682
Added by nobu (Nobuyoshi Nakada) almost 2 years ago

erb.rb: frozen-string-literal safe

  • lib/erb.rb (ERB#set_eoutvar): explicitly make mutable string as a buffer to make ERB work with --enable-frozen-string-literal. [Bug #12031]

Revision 53682
Added by nobu (Nobuyoshi Nakada) almost 2 years ago

erb.rb: frozen-string-literal safe

  • lib/erb.rb (ERB#set_eoutvar): explicitly make mutable string as a buffer to make ERB work with --enable-frozen-string-literal. [Bug #12031]

History

#1 Updated by nobu (Nobuyoshi Nakada) almost 2 years ago

  • Status changed from Open to Closed

Applied in changeset r53682.


erb.rb: frozen-string-literal safe

  • lib/erb.rb (ERB#set_eoutvar): explicitly make mutable string as a buffer to make ERB work with --enable-frozen-string-literal. [Bug #12031]

Also available in: Atom PDF