Daniel Berger created JRUBY-6444:
------------------------------------

             Summary: RangeError vs TypeError with FFI
                 Key: JRUBY-6444
                 URL: https://jira.codehaus.org/browse/JRUBY-6444
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.6.6
         Environment: jruby 1.6.6 (ruby-1.8.7-p357) (2012-01-30 5673572) (Java 
HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java]
            Reporter: Daniel Berger
            Assignee: Thomas E Enebo
            Priority: Minor


When passing an invalid type to an FFI function that requires an integer, JRuby 
raises a RangeError, whereas the C version raises a TypeError. I would expect a 
TypeError.
{noformat}
require 'ffi'

class Admin
  extend FFI::Library
  ffi_lib FFI::Library::LIBC

  attach_function :getpwuid, [:int], :pointer

  def self.get_user(uid)
    ptr = getpwuid(uid)
  end
end

Admin.get_user('foo') # TypeError using MRI, RangeError using JRuby
{noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to