summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2018-04-26 11:46:22 +0100
committerDavid Mitchell <davem@iabyn.com>2018-04-26 11:46:22 +0100
commitd8306453385a4991e40b4738982bf9617b6c1ccf (patch)
treef8083043183e2f3960a91d4f8eae78dec0735ddf
parentd98f51adb895010fdfbe73640d0f92bb48669f24 (diff)
downloadperl-d8306453385a4991e40b4738982bf9617b6c1ccf.tar.gz
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.
-rw-r--r--pp_sort.c3
-rw-r--r--t/op/sort.t13
2 files changed, 1 insertions, 15 deletions
diff --git a/pp_sort.c b/pp_sort.c
index 8be778e2f2..b4a9dd91e7 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 610db691b8..d201f00afd 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