summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorDagfinn Ilmari Mannsåker <ilmari@ilmari.org>2017-09-26 23:11:04 +0100
committerDagfinn Ilmari Mannsåker <ilmari@ilmari.org>2017-10-24 14:48:27 +0100
commit5bad3c4f3a4515aaa622eecdf6f5a84fcaff7ed9 (patch)
treea129f8376172e3fa1761945d5609ddce9fef1713 /pp.c
parent199e777d25e184ed0cfa8e4f08a8268d883daf33 (diff)
downloadperl-5bad3c4f3a4515aaa622eecdf6f5a84fcaff7ed9.tar.gz
Unweaken refs in in-place reverse
For consistency with assignment and in-place sort
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);
}
}
}