summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/variable.c b/variable.c
index 0cc87d7fd3..b920c6797d 100644
--- a/variable.c
+++ b/variable.c
@@ -1470,8 +1470,11 @@ rb_const_get_0(VALUE klass, ID id, int exclude, int recurse)
tmp = klass;
retry:
while (RTEST(tmp)) {
+ VALUE am = 0;
while (RCLASS_IV_TBL(tmp) && st_lookup(RCLASS_IV_TBL(tmp),id,&value)) {
if (value == Qundef) {
+ if (am == tmp) break;
+ am = tmp;
rb_autoload_load(tmp, id);
continue;
}