Bug #2730

Some methods still failing to raise RuntimeError when a frozen object would not be modified

Added by brixen (Brian Ford) over 2 years ago. Updated about 1 year ago.

[ruby-core:28140]
Status:Closed Start date:02/10/2010
Priority:Normal Due date:
Assignee:- % Done:

100%

Category:core
Target version:1.9.2
ruby -v:ruby 1.9.2dev (2010-02-09 trunk 26627) [i386-darwin9.8.0]

Description

Per matz's request in [ruby-core:23714], this ticket is for the methods that are still not raising a RuntimeError when called on a frozen object that would not be modified.

Array#concat
Array#flatten!
Array#insert
Array#uniq!
Array#unshift
Hash#initialize_copy
Hash#replace
String#replace

These failures can be seen running RubySpec HEAD. They were previously masked by improper ruby_bug guards.

Thanks,
Brian

Associated revisions

Revision 26632
Added by nobu (Nobuyoshi Nakada) over 2 years ago

* array.c (rb_ary_push_m, rb_ary_unshift_m, rb_ary_aset), (rb_ary_insert, rb_ary_replace, rb_ary_concat), (rb_ary_uniq_bang, rb_ary_flatten_bang): check if frozen after wrong number of arguments but before TypeError. [ruby-core:28140] * hash.c (rb_hash_replace): ditto. * string.c (rb_str_replace): ditto.

History

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100
This issue was solved with changeset r26632.
Brian, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

Also available in: Atom PDF