diff options
author | Jeremy Evans <[email protected]> | 2019-09-14 01:49:33 -0700 |
---|---|---|
committer | Jeremy Evans <[email protected]> | 2019-09-14 01:49:33 -0700 |
commit | b78a345bd63ff2b52ea0f84754ab0988748a9bd0 (patch) | |
tree | d529df7726d15a14d21c7b03a99b332dc93ba7d3 /eval.c | |
parent | b2c29bbab6e88253f497fc3e66a43cb7b4d425b5 (diff) |
Only set RB_PASS_CALLED_KEYWORDS in C functions called directly from Ruby
It is not safe to set this in C functions that can be called from
other C functions, as in the non argument-delegation case, you
can end up calling a Ruby method with a flag indicating keywords
are set without passing keywords.
Introduce some new *_kw functions that take a kw_splat flag and
use these functions to set RB_PASS_CALLED_KEYWORDS in places where
we know we are delegating methods (e.g. Class#new, Method#call)
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -1672,7 +1672,14 @@ void rb_obj_call_init(VALUE obj, int argc, const VALUE *argv) { PASS_PASSED_BLOCK_HANDLER(); - rb_funcallv_kw(obj, idInitialize, argc, argv, RB_PASS_CALLED_KEYWORDS); + rb_funcallv_kw(obj, idInitialize, argc, argv, RB_NO_KEYWORDS); +} + +void +rb_obj_call_init_kw(VALUE obj, int argc, const VALUE *argv, int kw_splat) +{ + PASS_PASSED_BLOCK_HANDLER(); + rb_funcallv_kw(obj, idInitialize, argc, argv, kw_splat); } /*! |