[ruby-core:118015] [Ruby master Bug#20510] File.open mode argument inconsistency
From:
"akr (Akira Tanaka) via ruby-core" <ruby-core@...>
Date:
2024-05-25 03:20:43 UTC
List:
ruby-core #118015
Issue #20510 has been reported by akr (Akira Tanaka).
----------------------------------------
Bug #20510: File.open mode argument inconsistency
https://bugs.ruby-lang.org/issues/20510
* Author: akr (Akira Tanaka)
* Status: Open
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
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]
```
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/