summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/marshal.c b/marshal.c
index ea43c62b94..a817cf9742 100644
--- a/marshal.c
+++ b/marshal.c
@@ -1690,6 +1690,9 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
v = r_object0(arg, &ivar, extmod);
if (ivar) r_ivar(v, NULL, arg);
+ if (RB_TYPE_P(v, T_STRING)) {
+ v = r_leave(v, arg);
+ }
}
break;
@@ -1819,7 +1822,9 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
case TYPE_STRING:
v = r_entry(r_string(arg), arg);
- v = r_leave(v, arg);
+ if (!ivp) {
+ v = r_leave(v, arg);
+ }
break;
case TYPE_REGEXP: