-
Notifications
You must be signed in to change notification settings - Fork 188
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
Make it possible to call instance_exec with rb_block_call #1802
Conversation
instance_exec switches self, which breaks the `RARRAY_PTR` call we were making inside the block where we are unsure about what `self` is. While we are at it, add a spec for the last argument of rb_block_call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! Could you add a change log entry?
object.__send__(method, *args) do |*block_args| | ||
TrufflePrimitive.cext_unwrap(TrufflePrimitive.call_with_c_mutex(func, [ | ||
TrufflePrimitive.cext_wrap(block_args.first), | ||
data, | ||
block_args.size, # argc | ||
RARRAY_PTR(block_args), # argv | ||
outer_self.RARRAY_PTR(block_args), # argv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use an explicit Truffle::CExt.RARRAY_PTR(block_args)
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make that change as it's a minor thing.
…1802). PullRequest: truffleruby/1124
instance_exec switches self, which breaks the
RARRAY_PTR
call we weremaking inside the block where we are unsure about what
self
is. Whilewe are at it, add a spec for the last argument of rb_block_call.
Shopify#1