From: "rhenium (Kazuki Yamaguchi) via ruby-core" Date: 2026-10-07T18:15:47+00:00 Subject: [ruby-core:126988] [Ruby Bug#22413] IO#wait_readable does not distinguish nil from an omitted timeout Issue #22413 has been reported by rhenium (Kazuki Yamaguchi). ---------------------------------------- Bug #22413: IO#wait_readable does not distinguish nil from an omitted timeout https://bugs.ruby-lang.org/issues/22413 * Author: rhenium (Kazuki Yamaguchi) * Status: Open * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- I was expecting `io.wait_readable(nil)` to wait indefinitely, but it is currently treated the same as omitting the argumen, so the value set by `IO#timeout=` is used: ```ruby IO.pipe{|r,w|r.timeout=1; r.wait_readable} # returns after 1 second, as expected IO.pipe{|r,w|r.timeout=1; r.wait_readable(nil)} # also returns after 1 second ``` Is this the intended behavior? Is `io.wait_readable(nil)` supposed to be a valid call at all, or is `nil` accepted only because of a loose argument check? The documentation for `IO#wait`, `IO#wait_readable`, and `IO#wait_writable` does not explain how the timeout parameter is handled. -- 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/lists/ruby-core.ml.ruby-lang.org/