aboutsummaryrefslogtreecommitdiffstats
path: root/thread.c
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-09-14 01:49:33 -0700
committerJeremy Evans <code@jeremyevans.net>2019-09-14 01:49:33 -0700
commitb78a345bd63ff2b52ea0f84754ab0988748a9bd0 (patch)
treed529df7726d15a14d21c7b03a99b332dc93ba7d3 /thread.c
parentb2c29bbab6e88253f497fc3e66a43cb7b4d425b5 (diff)
downloadruby-b78a345bd63ff2b52ea0f84754ab0988748a9bd0.tar.gz
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 'thread.c')
-rw-r--r--thread.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/thread.c b/thread.c
index 6958897fc1..3b6ded9609 100644
--- a/thread.c
+++ b/thread.c
@@ -882,7 +882,7 @@ thread_s_new(int argc, VALUE *argv, VALUE klass)
if (GET_VM()->main_thread->status == THREAD_KILLED)
rb_raise(rb_eThreadError, "can't alloc thread");
- rb_obj_call_init(thread, argc, argv);
+ rb_obj_call_init_kw(thread, argc, argv, RB_PASS_CALLED_KEYWORDS);
th = rb_thread_ptr(thread);
if (!threadptr_initialized(th)) {
rb_raise(rb_eThreadError, "uninitialized thread - check `%"PRIsVALUE"#initialize'",