Project

General

Profile

Actions

Bug #1649

closed

use of #send in MonitorMixin::extend_object fails for BasicSocket objects

Added by ysh (Young Hyun) over 15 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-freebsd6.1]
Backport:
[ruby-core:23907]

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:in send' from /foo/ruby-1.9.1-p129/lib/ruby/1.9.1/monitor.rb:140:in extend_object'
from (irb):7:in extend' from (irb):7 from /foo/ruby-1.9.1-p129/bin/irb:12:in '
=end

Actions

Also available in: Atom PDF

Like0
Like0