summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authorktsj <ktsj@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-07 04:58:38 +0000
committerktsj <ktsj@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-07 04:58:38 +0000
commit113b1c76fc9ace9f12f83e5edc7d4dadcc708c17 (patch)
tree255700898ecb0a81ece8c9a37a8c5b7ccc13db69 /variable.c
parent0a4801e768cd93c79666f32460306f132009aa9d (diff)
* 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/trunk@42867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/variable.c b/variable.c
index b3d9b3f6e8..3b3189bddc 100644
--- a/variable.c
+++ b/variable.c
@@ -177,9 +177,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;