summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 8cd066f532..139a2a24ab 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1135,13 +1135,15 @@ vm_get_const_base(const rb_iseq_t *iseq, const VALUE *lfp, const VALUE *dfp)
static inline void
vm_check_if_namespace(VALUE klass)
{
+ VALUE str;
switch (TYPE(klass)) {
case T_CLASS:
case T_MODULE:
break;
default:
+ str = rb_inspect(klass);
rb_raise(rb_eTypeError, "%s is not a class/module",
- RSTRING_PTR(rb_inspect(klass)));
+ RSTRING_PTR(RB_GC_GUARD(str)));
}
}