From: nobu@... Date: 2014-12-16T06:18:44+00:00 Subject: [ruby-core:66869] [ruby-trunk - Bug #10601] [Closed] Unexpected behaviour changes for Struct class Issue #10601 has been updated by Nobuyoshi Nakada. Status changed from Open to Closed % Done changed from 0 to 100 Applied in changeset r48864. ---------- iseq.c: struct accessors * iseq.c (rb_method_for_self_aref, rb_method_for_self_aset): call accessor functions directly, not to be affected by [] and []= methods. [ruby-core:66846] [Bug #10601] * struct.c (define_aref_method, define_aset_method): ditto. * vm_insnhelper.c (rb_vm_opt_struct_aref, rb_vm_opt_struct_aset): direct accessors of Struct. ---------------------------------------- Bug #10601: Unexpected behaviour changes for Struct class https://bugs.ruby-lang.org/issues/10601#change-50424 * Author: Hiroshi SHIBATA * Status: Closed * Priority: Normal * Assignee: Eric Wong * Category: * Target version: current: 2.2.0 * ruby -v: ruby 2.2.0dev (2014-12-14 trunk 48835) [x86_64-darwin13] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN ---------------------------------------- r48748 changes below code behaviour. ```ruby class Request < Struct.new(:params, :headers) def params=(hash) super end def []=(key, value) headers[key] = value end end Request.new.params = {} ``` ```sh % ruby -v test.rb ruby 2.2.0dev (2014-12-14 trunk 48835) [x86_64-darwin13] test.rb:7:in `[]=': undefined method `[]=' for nil:NilClass (NoMethodError) from :1:in `params=' from test.rb:3:in `params=' from test.rb:11:in `
' % ruby -v test.rb ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin13.0] ``` above code is included faraday known as famous http client library. >normal Can you investigate or revert r48748? I think this commit is feature category if it's your expected changes. We shouldn't apply this in 2.2.0.rc phase. -- https://bugs.ruby-lang.org/