This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Strengthen weak refs when sorting in-place
[perl5.git] / pp_sort.c
index ee1dc5d..5f39dba 100644 (file)
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -1769,6 +1769,9 @@ PP(pp_sort)
                     base[i] = newSVsv(sv);
                 else
                     SvREFCNT_inc_simple_void_NN(sv);
+
+                if (SvWEAKREF(sv))
+                    sv_rvunweaken(sv);
             }
             av_clear(av);
             if (max > 0) {