summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2019-05-07 12:00:57 +0200
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-07 21:20:01 +0900
commit7d805e67f3275aef066d77aa9c32bef715c362ed (patch)
treea380ab7eb259a345eaa9485d28a4c71969647d3a /object.c
parent6786fe44dcbb560d896bb9bb5baa9dc74677ce17 (diff)
Avoid triggering autoload in Module#const_defined?(String)
[Bug #15780]
Diffstat (limited to 'object.c')
-rw-r--r--object.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/object.c b/object.c
index 35f07d995d..00a70898f3 100644
--- a/object.c
+++ b/object.c
@@ -2694,16 +2694,19 @@ rb_mod_const_defined(int argc, VALUE *argv, VALUE mod)
if (!RTEST(recur)) {
if (!rb_const_defined_at(mod, id))
return Qfalse;
+ if (p == pend) return Qtrue;
mod = rb_const_get_at(mod, id);
}
else if (beglen == 0) {
if (!rb_const_defined(mod, id))
return Qfalse;
+ if (p == pend) return Qtrue;
mod = rb_const_get(mod, id);
}
else {
if (!rb_const_defined_from(mod, id))
return Qfalse;
+ if (p == pend) return Qtrue;
mod = rb_const_get_from(mod, id);
}
#endif