aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/ruby/test_thread.rb7
-rw-r--r--thread.c4
2 files changed, 9 insertions, 2 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb
index b61e90166f..213b1f908e 100644
--- a/test/ruby/test_thread.rb
+++ b/test/ruby/test_thread.rb
@@ -27,6 +27,13 @@ class TestThread < Test::Unit::TestCase
end
end
+ def test_inspect
+ th = Module.new {break module_eval("class C\u{30b9 30ec 30c3 30c9} < Thread; self; end")}.start{}
+ assert_match(/::C\u{30b9 30ec 30c3 30c9}:/, th.inspect)
+ ensure
+ th.join
+ end
+
def test_main_thread_variable_in_enumerator
assert_equal Thread.main, Thread.current
diff --git a/thread.c b/thread.c
index eb6ceaf156..c717184f10 100644
--- a/thread.c
+++ b/thread.c
@@ -2679,14 +2679,14 @@ rb_thread_safe_level(VALUE thread)
static VALUE
rb_thread_inspect(VALUE thread)
{
- const char *cname = rb_obj_classname(thread);
+ VALUE cname = rb_class_path(rb_obj_class(thread));
rb_thread_t *th;
const char *status;
VALUE str;
GetThreadPtr(thread, th);
status = thread_status_name(th);
- str = rb_sprintf("#<%s:%p %s>", cname, (void *)thread, status);
+ str = rb_sprintf("#<%"PRIsVALUE":%p %s>", cname, (void *)thread, status);
OBJ_INFECT(str, thread);
return str;