-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Finalizer capture warning #3444
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2739,6 +2739,18 @@ rb_obj_method_arity(VALUE obj, ID id) | |
return rb_mod_method_arity(CLASS_OF(obj), id); | ||
} | ||
|
||
VALUE | ||
rb_callable_receiver(VALUE callable) { | ||
if (rb_obj_is_proc(callable)) { | ||
VALUE binding = rb_funcall(callable, rb_intern("binding"), 0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please do not depend on Proc#binding because it can be limited in a future. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm not sure why I didn't call the methods directly since it's in the same compilation unit. I'll try that. |
||
return rb_funcall(binding, rb_intern("receiver"), 0); | ||
} else if (rb_obj_is_method(callable)) { | ||
return method_receiver(callable); | ||
} else { | ||
return Qundef; | ||
} | ||
} | ||
|
||
const rb_method_definition_t * | ||
rb_method_def(VALUE method) | ||
{ | ||
|
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.
do not add public API without any discussion.
At least, there is no
rb_callable
methods in public C-API.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.
Oh, sorry. I thought this was an 'internal' API - that's where the header is?
Or do you mean the symbol is literally visible after linking?
Do you want to revert the merge and let me find a way to fix it from where?
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.
now it is confusing.
maybe toplevel/internal/xxx will be a good place.