mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
variable.c: preserve name encoding of subclass
* variable.c (rb_tmp_class_path): preserve name encoding of an anonymous instance of module/class subclass. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0066608c13
commit
1ef1a0c602
3 changed files with 12 additions and 7 deletions
12
variable.c
12
variable.c
|
@ -228,21 +228,19 @@ rb_tmp_class_path(VALUE klass, int *permanent, path_cache_func cache_path)
|
|||
return (VALUE)n;
|
||||
}
|
||||
else {
|
||||
const char *s = "Class";
|
||||
|
||||
if (RB_TYPE_P(klass, T_MODULE)) {
|
||||
if (rb_obj_class(klass) == rb_cModule) {
|
||||
s = "Module";
|
||||
path = rb_sprintf("#<Module:%p>", (void*)klass);
|
||||
}
|
||||
else {
|
||||
int perm;
|
||||
VALUE path;
|
||||
|
||||
path = rb_tmp_class_path(RBASIC(klass)->klass, &perm, cache_path);
|
||||
s = RSTRING_PTR(path);
|
||||
path = rb_sprintf("#<%"PRIsVALUE":%p>", path, (void*)klass);
|
||||
}
|
||||
}
|
||||
path = rb_sprintf("#<%s:%p>", s, (void*)klass);
|
||||
else {
|
||||
path = rb_sprintf("#<Class:%p>", (void*)klass);
|
||||
}
|
||||
OBJ_FREEZE(path);
|
||||
|
||||
cache_path(klass, tmp_classpath, path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue