-
Notifications
You must be signed in to change notification settings - Fork 25
Avoid the use of the rb_eval_cmd_kw function if it is not available #76
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
base: master
Are you sure you want to change the base?
Avoid the use of the rb_eval_cmd_kw function if it is not available #76
Conversation
|
ruby/ruby#15404 intended to deprecate it, not actually remove it. We should fix it there, and then Both |
I agree. I'm not sure why the deprecation code does not work as expected. However, even if it is only deprecated and not actually removed, we shouldn't be using it in the
I don't think we can always use |
|
Sorry, I simplified it too much. I meant that the new code path added in this PR, using I submitted a PR to ruby/ruby to restore the declaration with a proper deprecation attribute: ruby/ruby#15435 |
|
While we could continue to use If the approach in this PR is too ugly, and there is no way to improve it and keep backwards compatibility, then I think we should not deprecate |
Agreed. AFAIK IMHO, the functionality provided by |
Once your Ruby PR is merged, the new code in this PR would not be used. It would only start being used once Ruby actually drops the method. I think that's acceptable. That allows us to keep full backwards compatibility for as long as possible. While I think this PR is backwards compatible, I'm not 100% sure it is in all respects. If Ruby adds support for checking for deprecated functions, I would be in favor of using it and switching to this new code if deprecation is detected.
I agree. I don't know the historical reason behind having a single function that either evaluates a string or calls a proc, instead of having two separate functions. |
| val = rb_protect(tk_eval_cmd_call, (VALUE)&args, &pstate); | ||
| RB_GC_GUARD(rest); | ||
| return val; | ||
| } |
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.
rb_eval_cmd_kw() in https://github.com/ruby/ruby/blob/941e70ab38d01d067b7bbbcdf8553893a9ca8b49/vm_eval.c#L2148-L2179 doesn't suppress exceptions. The rb_protect() around the eval and funcall should be unnecessary.
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.
Thank you. I misunderstood the purpose of the tag code in rb_eval_cmd_call_kw when trying to recreate the behavior. I'll update the PR.
|
I also think that's acceptable. My suggestion is if we really want to avoid all deprecation warnings. |
5985d8a to
3b6e3ce
Compare
Fixes #75