1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

object.c: inadvertent symbol

* object.c (rb_mod_const_get): avoid inadvertent symbol creation.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-11-07 00:16:03 +00:00
parent db54dc7215
commit bd9b31e557
2 changed files with 14 additions and 2 deletions

View file

@ -1,3 +1,7 @@
Wed Nov 7 09:15:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* object.c (rb_mod_const_get): avoid inadvertent symbol creation.
Wed Nov 7 07:52:50 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* enum.c (rb_enum_cycle_size): prefix with rb.

View file

@ -1947,13 +1947,21 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod)
}
while (*p) {
VALUE part;
while (*p && *p != ':') p++;
if (pbeg == p) {
rb_raise(rb_eNameError, "wrong constant name %s", path);
}
id = rb_intern3(pbeg, p-pbeg, enc);
id = rb_check_id_cstr(pbeg, p-pbeg, enc);
if (id) {
part = ID2SYM(id);
}
else {
part = rb_str_subseq(name, pbeg-path, p-pbeg);
}
if (p[0] == ':') {
if (p[1] != ':') {
rb_raise(rb_eNameError, "wrong constant name %s", path);
@ -1966,7 +1974,7 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod)
rb_raise(rb_eTypeError, "%s does not refer to class/module", path);
}
mod = rb_mod_single_const_get(mod, ID2SYM(id), recur);
mod = rb_mod_single_const_get(mod, part, recur);
}
return mod;