Project

General

Profile

Actions

Bug #12930

closed

instance_eval, instance_exec raises TypeError on a frozen String

Added by matsuda (Akira Matsuda) about 8 years ago. Updated almost 8 years ago.

Status:
Closed
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 1 (0 open1 closed)

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

Updated by matsuda (Akira Matsuda) about 8 years ago

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

Updated by nobu (Nobuyoshi Nakada) about 8 years ago

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

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?

Actions #3

Updated by nobu (Nobuyoshi Nakada) about 8 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) almost 8 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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0