[ruby-core:113834] [Ruby master Bug#19721] IO#timeout= can be called without required argument
From:
"andrykonchin (Andrew Konchin) via ruby-core" <ruby-core@...>
Date:
2023-06-08 20:21:35 UTC
List:
ruby-core #113834
Issue #19721 has been updated by andrykonchin (Andrew Konchin).
Ah, I see. Thank you.
----------------------------------------
Bug #19721: IO#timeout= can be called without required argument
https://bugs.ruby-lang.org/issues/19721#change-103480
* Author: andrykonchin (Andrew Konchin)
* Status: Rejected
* Priority: Normal
* ruby -v: 3.2.1
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
```ruby
f = File.open("a.txt", "w")
f.timeout=() # => nil
```
`IO#timeout=` requires an argument (or it's supposed to require it) but if it's called as a method it seems the check is skipped and missing argument is treated as `nil` value.
If it's called with `#send` - then argument presence is checked:
```ruby
f.send :"timeout="
# ...:in `timeout=': wrong number of arguments (given 0, expected 1) (ArgumentError)
```
--
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/