Bug #530: socket.c: TCPSocket registered with wrong arity http://redmine.ruby-lang.org/issues/show/530 Author: Mike Furr Status: Open, Priority: Normal 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); ---------------------------------------- http://redmine.ruby-lang.org