Bug #7543

DL::Function#bound? and unbind raise error when Fiddle is available

Added by Naohisa Goto over 2 years ago. Updated over 2 years ago.

[ruby-core:<unknown>]
Status:Closed
Priority:Normal
Assignee:-
ruby -v:- Backport:

Description

When Fiddle is available, DL::Function#unbind raises error.

require 'dl'
require 'dl/func'
include DL
f = Function.new(CFunc.new(0, TYPE_INT, 'test'), [TYPE_INT, TYPE_INT])
f.bind { |x,y| x + y }
f.unbind

The above code raises the following error in "f.unbind".
/XXXX/lib/ruby/2.0.0/dl/func.rb:160:in unbind': undefined methodptr' for #<#Class:0x007f8e8f29ae08:0x007f8e8f29ad40> (NoMethodError)
from -:6:in `'

When Fiddle is available, DL::Function#bound? also raises error.

require 'dl'
require 'dl/func'
include DL
f = Function.new(CFunc.new(0, TYPE_INT, 'test'), [TYPE_INT, TYPE_INT])
f.bind { |x,y| x + y }
f.bound?

The above code raises the following error in "f.bound?".
/XXXX/lib/ruby/2.0.0/dl/func.rb:174:in bound?': undefined methodptr' for #<#Class:0x007f6708842d78:0x007f6708842cb0> (NoMethodError)
from -:6:in `'

Associated revisions

Revision 38324
Added by Naohisa Goto over 2 years ago

  • ext/dl/lib/dl/func.rb (DL::Function#unbind, #bound?): suppress NoMethodError when Fiddle is available. [Bug #7543]
  • test/dl/test_func.rb (test_bound*, test_unbind*): tests for the above.

Revision 38324
Added by Naohisa Goto over 2 years ago

  • ext/dl/lib/dl/func.rb (DL::Function#unbind, #bound?): suppress NoMethodError when Fiddle is available. [Bug #7543]
  • test/dl/test_func.rb (test_bound*, test_unbind*): tests for the above.

History

#1 Updated by Naohisa Goto over 2 years ago

  • Subject changed from DL::Function#bound? and unbound raise error when Fiddle is available to DL::Function#bound? and unbind raise error when Fiddle is available

#2 Updated by Naohisa Goto over 2 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r38324.
Naohisa, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • ext/dl/lib/dl/func.rb (DL::Function#unbind, #bound?): suppress NoMethodError when Fiddle is available. [Bug #7543]
  • test/dl/test_func.rb (test_bound*, test_unbind*): tests for the above.

Also available in: Atom PDF