Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FFI::Pointer#== to not throw an exception #1083

Merged
merged 1 commit into from
Mar 29, 2024
Merged

Conversation

cfis
Copy link
Contributor

@cfis cfis commented Mar 28, 2024

If you call FFI::Pointer#== with an instance of an object that is not FFI::Pointer or descendants an exception is thrown:

"INTERNAL ERROR!!! TypeError: wrong argument type Module (expected FFI::Pointer).

In my case, this then causes the RubyMine debugger (debase) to blow up, making debugging harder.

This PR updates FFI::Pointer#== to return false if a pointer is compared to a non-pointer object, which is the expected behavior.

@eregon
Copy link
Collaborator

eregon commented Mar 28, 2024

Could you add a test for this?

… FFI::Pointer or descendants an exception is thrown - "INTERNAL ERROR!!! TypeError: wrong argument type Module (expected FFI::Pointer). In my case, this then causes the RubyMine debugger (debase) to blow up, making debugging harder.

This PR updates FFI::Pointer#== to return false if a pointer is compared to a non-pointer object, which is the expected behavior.
@cfis
Copy link
Contributor Author

cfis commented Mar 29, 2024

Sure, added a few tests for Pointer#==

@larskanis larskanis merged commit 0727ada into ffi:master Mar 29, 2024
41 of 42 checks passed
@larskanis
Copy link
Member

Thank you, looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants