Project

General

Profile

Bug #7543

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

Added by ngoto (Naohisa Goto) over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:<unknown>]

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 1fcde7c2
Added by ngoto (Naohisa Goto) over 5 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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 38324
Added by ngoto (Naohisa Goto) over 5 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 ngoto (Naohisa Goto) over 5 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 ngoto (Naohisa Goto) over 5 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 ngoto (Naohisa Goto) over 5 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 ngoto (Naohisa Goto) over 5 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 74bca55d
Added by usa (Usaku NAKAMURA) over 5 years ago

merge revision(s) 38202,38238,38324,38326: [Backport #7527]

  • test/dl/test_func.rb (test_name_with_block, test_bind, test_qsort1):
    call unbind to release the callback closure because maximum number
    of callbacks is limited to DL::MAX_CALLBACK (== 5) with pure DL
    without Fiddle.

  • 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.

  • ext/dl/lib/dl/func.rb (DL::Function#initialize, DL::Function#bind):
    ABI should be set by using CFunc#calltype even when Fiddle is used.
    When Fiddle is used and a block is given, name shoud not be ignored.
    [Bug #7514]

  • ext/dl/lib/dl/import.rb (DL::Importer#bind_function): should respect
    abi and name when Fiddle is used.

  • test/dl/test_func.rb (test_name_with_block): test for "name" method
    with giving a block.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

History

#1 Updated by ngoto (Naohisa Goto) over 5 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 ngoto (Naohisa Goto) over 5 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