Actions
Bug #12930
closedinstance_eval, instance_exec raises TypeError on a frozen String
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
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?
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) over 7 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
Like0
Like0Like0Like0Like0