Project

General

Profile

Bug #12930

instance_eval, instance_exec raises TypeError on a frozen String

Added by matsuda (Akira Matsuda) over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.4.0dev (2016-11-13 trunk 56767) [x86_64-darwin15]
[ruby-core:78110]

Description

% ruby -ve 'p "".freeze.instance_eval "size"'
ruby 2.4.0dev (2016-11-13 trunk 56767) [x86_64-darwin15]
-e:1:in `instance_eval': can't define singleton (TypeError)

since 56747


Related issues

Related to Ruby master - Bug #12923: Accessing singleton_class of fstring cause assertion failureClosedmatz (Yukihiro Matsumoto)Actions
#1

Updated by matsuda (Akira Matsuda) over 3 years ago

  • Related to Bug #12923: Accessing singleton_class of fstring cause assertion failure added

Updated by nobu (Nobuyoshi Nakada) over 3 years ago

  • Assignee changed from nobu (Nobuyoshi Nakada) to matz (Yukihiro Matsumoto)
  • Status changed from Open to Assigned

A string literal with .freeze reveals the object in the shared frozen string literal pool.
I think that shared objects should not be modified, like Integer and Float.
Any idea?

#3

Updated by nobu (Nobuyoshi Nakada) over 3 years ago

  • Status changed from Assigned to Closed

Applied in changeset r56777.


vm_eval.c: fstring instance_eval

  • vm_eval.c (singleton_class_for_eval): enable fstring singleton class for instance_eval. [ruby-core:78116] [Bug #12930]

Updated by nagachika (Tomoyuki Chikanaga) over 3 years ago

  • Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: DONTNEED, 2.2: DONTNEED, 2.3: DONE

ruby_2_3 r58157 merged revision(s) 56747,56754,56777.

Also available in: Atom PDF