Actions
Bug #530
closedsocket.c: TCPSocket registered with wrong arity
Description
=begin
The C code for TCPSocket#initialize does not register it with the correct arity. Therefore, reflective methods return incorrect information:
irb(main):001:0> require 'socket'
=> true
irb(main):002:0> TCPSocket.method(:initialize).arity
=> -1
irb(main):003:0> TCPSocket.new
ArgumentError: wrong number of arguments (0 for 2)
from (irb):3:in initialize' from (irb):3:in
new'
from (irb):3
The culprit seems to be in ext/socket/socket.c:3943
rb_define_method(rb_cTCPSocket, "initialize", tcp_init, -1);
should be
rb_define_method(rb_cTCPSocket, "initialize", tcp_init, -3);
=end
Actions
Like0
Like0Like0