https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112013-02-13T05:14:39ZRuby Issue Tracking SystemRuby master - Bug #7837: IO.open with three arguments where third argument is bogus reports an arity problem instead of type problemhttps://bugs.ruby-lang.org/issues/7837?journal_id=361802013-02-13T05:14:39Zdrbrain (Eric Hodel)drbrain@segment7.net
<ul><li><strong>Category</strong> set to <i>core</i></li><li><strong>Target version</strong> set to <i>2.6</i></li></ul><p>=begin<br>
Since Ruby 1.9.3p374 has the same behavior I have marked this for next minor:</p>
<p>$ ruby19 -ve 'f = File.open("tmp"); IO.open(f.fileno, "r", :heh)'<br>
ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-darwin12.2.1]<br>
-e:1:in <code>initialize': wrong number of arguments (3 for 1..2) (ArgumentError) from -e:1:in </code>open'<br>
from -e:1:in `'</p>
<p>=end</p> Ruby master - Bug #7837: IO.open with three arguments where third argument is bogus reports an arity problem instead of type problemhttps://bugs.ruby-lang.org/issues/7837?journal_id=361962013-02-13T14:39:13Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Rejected</i></li></ul><p>=begin<br>
It's common behavior to keyword arguments,</p>
<p>$ ruby -e 'def foo(a, b, c:1);end' -e 'foo(2,3,42)'<br>
-e:1:in <code>foo': wrong number of arguments (3 for 2) (ArgumentError) from -e:2:in </code>'</p>
<p>The optional argument hash is stripped before arity check, so it's "invisible" as arity.<br>
=end</p>