ruby-changes:30788
From: ktsj <ko1@a...>
Date: Sat, 7 Sep 2013 13:58:45 +0900 (JST)
Subject: [ruby-changes:30788] ktsj:r42867 (trunk): * variable.c (classname): the name of class that has
ktsj 2013-09-07 13:58:38 +0900 (Sat, 07 Sep 2013) New Revision: 42867 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42867 Log: * variable.c (classname): the name of class that has non class id should not be nil. This bug was introduced in r36577. * test/thread/test_cv.rb: test for change. Modified files: trunk/ChangeLog trunk/test/thread/test_cv.rb trunk/variable.c Index: ChangeLog =================================================================== --- ChangeLog (revision 42866) +++ ChangeLog (revision 42867) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Sep 7 13:49:40 2013 Kazuki Tsujimoto <kazuki@c...> + + * variable.c (classname): the name of class that has + non class id should not be nil. This bug was introduced + in r36577. + + * test/thread/test_cv.rb: test for change. + Sat Sep 7 13:29:22 2013 Kazuki Tsujimoto <kazuki@c...> * lib/find.rb (Find.find): respect the encodings of arguments. Index: variable.c =================================================================== --- variable.c (revision 42866) +++ variable.c (revision 42867) @@ -177,9 +177,14 @@ classname(VALUE klass, int *permanent) https://github.com/ruby/ruby/blob/trunk/variable.c#L177 path = find_class_path(klass, (ID)0); } if (NIL_P(path)) { - if (!cid || !st_lookup(RCLASS_IV_TBL(klass), (st_data_t)tmp_classpath, &n)) { + if (!cid) { return Qnil; } + if (!st_lookup(RCLASS_IV_TBL(klass), (st_data_t)tmp_classpath, &n)) { + path = rb_str_dup(rb_id2str(cid)); + OBJ_FREEZE(path); + return path; + } *permanent = 0; path = (VALUE)n; return path; Index: test/thread/test_cv.rb =================================================================== --- test/thread/test_cv.rb (revision 42866) +++ test/thread/test_cv.rb (revision 42867) @@ -82,20 +82,23 @@ class TestConditionVariable < Test::Unit https://github.com/ruby/ruby/blob/trunk/test/thread/test_cv.rb#L82 end def test_condvar_wait_deadlock - assert_in_out_err([], <<-INPUT, ["No live threads left. Deadlock?"], []) + assert_in_out_err([], <<-INPUT, ["fatal", "No live threads left. Deadlock?"], []) require "thread" mutex = Mutex.new cv = ConditionVariable.new + klass = nil mesg = nil begin mutex.lock cv.wait mutex mutex.unlock rescue Exception => e + klass = e.class mesg = e.message end + puts klass print mesg INPUT end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/