Bug #1649
closeduse of #send in MonitorMixin::extend_object fails for BasicSocket objects
Description
=begin
MonitorMixin::extend_object executes obj.send(:mon_initialize) with the intention of invoking Object#send. However, this code fails when used on BasicSocket (and descendants), which has an unrelated #send. MonitorMixin::extend_object should use send or revert back to the old code: obj.instance_eval {mon_initialize()}.
Reproduce with:
require 'socket'
=> true
sock_pair = UNIXSocket.pair Socket::SOCK_STREAM, 0
=> [#UNIXSocket:0x8401868, #UNIXSocket:0x840187c]
require 'monitor'
=> true
sock_pair[1].extend MonitorMixin
ArgumentError: wrong number of arguments (1 for 2)
from /foo/ruby-1.9.1-p129/lib/ruby/1.9.1/monitor.rb:140:insend' from /foo/ruby-1.9.1-p129/lib/ruby/1.9.1/monitor.rb:140:in
extend_object'
from (irb):7:inextend' from (irb):7 from /foo/ruby-1.9.1-p129/bin/irb:12:in
'
=end
Updated by matz (Yukihiro Matsumoto) over 15 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
Applied in changeset r23754.
=end