summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/variable.c b/variable.c
index fcbc8cc745..8b62aad92a 100644
--- a/variable.c
+++ b/variable.c
@@ -1387,10 +1387,12 @@ rb_mod_const_of(mod, data)
VALUE mod;
void *data;
{
+ VALUE tmp = mod;
for (;;) {
- data = rb_mod_const_at(mod, data);
- mod = RCLASS(mod)->super;
- if (!mod) break;
+ data = rb_mod_const_at(tmp, data);
+ tmp = RCLASS(tmp)->super;
+ if (!tmp) break;
+ if (tmp == rb_cObject && mod != rb_cObject) break;
}
return data;
}