Project

General

Profile

Actions

Bug #12031

closed

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

Added by jeremyevans0 (Jeremy Evans) about 8 years ago. Updated about 8 years ago.

Status:
Closed
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

Files

Actions #1

Updated by nobu (Nobuyoshi Nakada) about 8 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.
    [ruby-core:73561] [Bug #12031]
Actions

Also available in: Atom PDF

Like0
Like0