summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/pp.c b/pp.c
index 42bea4db70..382ee96fe9 100644
--- a/pp.c
+++ b/pp.c
@@ -5586,7 +5586,14 @@ PP(pp_reverse)
SV * const tmp = *begin;
*begin++ = *end;
*end-- = tmp;
+
+ if (tmp && SvWEAKREF(tmp))
+ sv_rvunweaken(tmp);
}
+
+ /* make sure we catch the middle element */
+ if (begin == end && *begin && SvWEAKREF(*begin))
+ sv_rvunweaken(*begin);
}
}
}