summaryrefslogtreecommitdiff
path: root/struct.c
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-09-29 13:15:04 -0700
committerJeremy Evans <code@jeremyevans.net>2019-09-29 16:28:52 -0700
commit58dfea0c8de29cbad35621847c04372b779c5f5d (patch)
tree10f03180414b703f8cddb7c18138f76e46a29712 /struct.c
parent59060aadea28d3a6cd0ebbcc17c10a3628e6e867 (diff)
Make direct calls to rb_{obj_instance,mod_module}_{eval,exec} not pass keywords
In general RB_PASS_CALLED_KEYWORDS should only be set if we are sure the arguments passed come directly from Ruby. For direct calls to these C functions, we should not assume that keywords are passed. Add static *_internal versions of these functions that Kernel#instance_{eval,exec} and Module#{class,module}_{eval,exec} call that set RB_PASS_CALLED_KEYWORDS. Also, change struct.c back to calling rb_mod_module_eval, now that the call is safe.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2505
Diffstat (limited to 'struct.c')
-rw-r--r--struct.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/struct.c b/struct.c
index 3a631ab189..b2935747ed 100644
--- a/struct.c
+++ b/struct.c
@@ -569,7 +569,7 @@ rb_struct_s_def(int argc, VALUE *argv, VALUE klass)
setup_struct(st, rest);
rb_ivar_set(st, id_keyword_init, keyword_init);
if (rb_block_given_p()) {
- rb_funcall_passing_block(st, rb_intern("module_eval"), 0, 0);
+ rb_mod_module_eval(0, 0, st);
}
return st;