summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/ruby/test_thread.rb13
-rw-r--r--thread.c4
2 files changed, 15 insertions, 2 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb
index 87d5f0f79e..ade680c55b 100644
--- a/test/ruby/test_thread.rb
+++ b/test/ruby/test_thread.rb
@@ -1033,4 +1033,17 @@ q.pop
assert_not_predicate(status, :signaled?, FailDesc[status, bug9751, output])
assert_predicate(status, :success?, bug9751)
end if Process.respond_to?(:fork)
+
+ def test_subclass_no_initialize
+ t = Module.new do
+ break eval("class C\u{30b9 30ec 30c3 30c9} < Thread; self; end")
+ end
+ t.class_eval do
+ def initialize
+ end
+ end
+ assert_raise_with_message(ThreadError, /C\u{30b9 30ec 30c3 30c9}/) do
+ t.new {}
+ end
+ end
end
diff --git a/thread.c b/thread.c
index bd517366cd..6cf6d52727 100644
--- a/thread.c
+++ b/thread.c
@@ -736,8 +736,8 @@ thread_s_new(int argc, VALUE *argv, VALUE klass)
rb_obj_call_init(thread, argc, argv);
GetThreadPtr(thread, th);
if (!th->first_args) {
- rb_raise(rb_eThreadError, "uninitialized thread - check `%s#initialize'",
- rb_class2name(klass));
+ rb_raise(rb_eThreadError, "uninitialized thread - check `%"PRIsVALUE"#initialize'",
+ klass);
}
return thread;
}