Actions
Bug #20510
closedFile.open mode argument inconsistency
Description
I found that
File.new(1, mode: File::WRONLY, path: "foo")
succeeds but
File.new(1, File::WRONLY, path: "foo")
fails.
It is inconsistent.
I think they should both succeed.
% ./ruby -e 'p File.new(1, mode: File::WRONLY, path: "foo")'
#<File:foo>
% ./ruby -e 'p File.new(1, File::WRONLY, path: "foo")'
-e:1:in 'File#initialize': no implicit conversion of Integer into String (TypeError)
p File.new(1, File::WRONLY, path: "foo")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
from -e:1:in 'IO.new'
from -e:1:in '<main>'
% ./ruby -v
ruby 3.4.0dev (2024-05-25T02:25:56Z tempfile-create-io 99463a8400) [x86_64-linux]
Actions
Like0
Like0Like0