From: nobu@... Date: 2020-04-18T09:05:50+00:00 Subject: [ruby-core:97948] [Ruby master Bug#16797] Array#flatten not checking `respond_to? :to_ary` Issue #16797 has been updated by nobu (Nobuyoshi Nakada). Status changed from Open to Rejected Read the error message. ``` -:4:in `flatten': can't convert Object to Array (Object#to_ary gives Object) (TypeError) ``` ---------------------------------------- Bug #16797: Array#flatten not checking `respond_to? :to_ary` https://bugs.ruby-lang.org/issues/16797#change-85172 * Author: UlyssesZhan (������ ���) * Status: Rejected * Priority: Normal * ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- ```ruby def (a = Object.new).method_missing(...) Object.new end [a].flatten # TypeError ``` It should check whether an object responds to `to_ary` before trying to convert it into an array. -- https://bugs.ruby-lang.org/ Unsubscribe: