Project

General

Profile

Bug #17094

PTY methods with blocks

Added by soutaro (Soutaro Matsumoto) 6 days ago. Updated 5 days ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-dev:50941]

Description

Some methods on PTY yields one array if a block is given, but the RDoc says it passes two arguments to the block.

https://github.com/ruby/ruby/blob/master/ext/pty/pty.c#L529

return rb_ensure(rb_yield, assoc, pty_close_pty, assoc);

https://github.com/ruby/ruby/blob/master/ext/pty/pty.c#L467

 *   PTY.open {|master_io, slave_file| ... } => block value

I'd like to propose to fix the implementation. However, it would make more sense to fix the docs because of potential incompatibilities.

Updated by nobu (Nobuyoshi Nakada) 6 days ago

As it can be incompatible only when passing a lambda, I don't think it is a serious problem.

Updated by soutaro (Soutaro Matsumoto) 5 days ago

Runtime testing of RBS uncovered this issue.

https://github.com/ruby/rbs/pull/346#issuecomment-665817340

The RDoc implies the type of (*String) { (IO, IO) -> void } -> void, but the implementation is (*String) { ([IO, IO]) -> void } -> void. And runtime type checking detected the issue.

Maybe we can fix the RBS runtime type checking then.

Also available in: Atom PDF