mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
thread.c: class name encoding
* thread.c (thread_s_new): preserve the encoding of the class name in an error message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
962909f0ef
commit
c5e9beac25
2 changed files with 15 additions and 2 deletions
|
@ -1033,4 +1033,17 @@ q.pop
|
||||||
assert_not_predicate(status, :signaled?, FailDesc[status, bug9751, output])
|
assert_not_predicate(status, :signaled?, FailDesc[status, bug9751, output])
|
||||||
assert_predicate(status, :success?, bug9751)
|
assert_predicate(status, :success?, bug9751)
|
||||||
end if Process.respond_to?(:fork)
|
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
|
end
|
||||||
|
|
4
thread.c
4
thread.c
|
@ -736,8 +736,8 @@ thread_s_new(int argc, VALUE *argv, VALUE klass)
|
||||||
rb_obj_call_init(thread, argc, argv);
|
rb_obj_call_init(thread, argc, argv);
|
||||||
GetThreadPtr(thread, th);
|
GetThreadPtr(thread, th);
|
||||||
if (!th->first_args) {
|
if (!th->first_args) {
|
||||||
rb_raise(rb_eThreadError, "uninitialized thread - check `%s#initialize'",
|
rb_raise(rb_eThreadError, "uninitialized thread - check `%"PRIsVALUE"#initialize'",
|
||||||
rb_class2name(klass));
|
klass);
|
||||||
}
|
}
|
||||||
return thread;
|
return thread;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue