From d8306453385a4991e40b4738982bf9617b6c1ccf Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Thu, 26 Apr 2018 11:46:22 +0100 Subject: [PATCH] Revert "Strengthen weak refs when sorting in-place" This reverts commit f6107ca24b4cf22dcf7fd69d65612ad718c48fca. See RT #132142. For now, re-introduce the bug that fails to convert weak refs to strong refs when sorting in place. This is commit 2 of 2. --- pp_sort.c | 3 --- t/op/sort.t | 13 +------------ 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/pp_sort.c b/pp_sort.c index 8be778e..b4a9dd9 100644 --- a/pp_sort.c +++ b/pp_sort.c @@ -1094,9 +1094,6 @@ 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) { diff --git a/t/op/sort.t b/t/op/sort.t index 610db69..d201f00 100644 --- a/t/op/sort.t +++ b/t/op/sort.t @@ -7,7 +7,7 @@ BEGIN { set_up_inc('../lib'); } use warnings; -plan(tests => 200); +plan(tests => 199); # these shouldn't hang { @@ -492,18 +492,7 @@ cmp_ok($x,'eq','123',q(optimized-away comparison block doesn't take any other ar @a = sort { $a <=> $b } @a; $$r = "z"; is ("@a", "3 4 5", "RT #128340"); -} -# in-place sorting of weak references -SKIP: { - skip_if_miniperl("no dynamic loading on miniperl, no extension Scalar::Util", 1); - require Scalar::Util; - my @a = map { \(my $dummy = $_) } qw(c a d b); - my $r = $a[1]; - Scalar::Util::weaken($a[1]); - @a = sort { $$a cmp $$b } @a; - undef $r; - ok defined $a[0] && ${$a[0]} eq 'a', "in-place sort strengthens weak references"; } # Test optimisations of reversed sorts. As we now guarantee stability by -- 1.8.3.1