From 089106508261787f7b43840b0249a1f9e1fea9a0 Mon Sep 17 00:00:00 2001 From: nagachika Date: Wed, 11 Sep 2013 15:27:13 +0000 Subject: merge revision(s) 42867: [Backport #8873] * 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@42911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- variable.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'variable.c') diff --git a/variable.c b/variable.c index 1be62dc1db..080cf39e00 100644 --- a/variable.c +++ b/variable.c @@ -175,9 +175,14 @@ classname(VALUE klass, int *permanent) 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; -- cgit v1.2.3