Skip to content

Commit d830645

Browse files
committed
Revert "Strengthen weak refs when sorting in-place"
This reverts commit f6107ca. 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.
1 parent d98f51a commit d830645

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

pp_sort.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,9 +1094,6 @@ PP(pp_sort)
10941094
base[i] = newSVsv(sv);
10951095
else
10961096
SvREFCNT_inc_simple_void_NN(sv);
1097-
1098-
if (SvWEAKREF(sv))
1099-
sv_rvunweaken(sv);
11001097
}
11011098
av_clear(av);
11021099
if (max > 0) {

t/op/sort.t

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ BEGIN {
77
set_up_inc('../lib');
88
}
99
use warnings;
10-
plan(tests => 200);
10+
plan(tests => 199);
1111

1212
# these shouldn't hang
1313
{
@@ -492,18 +492,7 @@ cmp_ok($x,'eq','123',q(optimized-away comparison block doesn't take any other ar
492492
@a = sort { $a <=> $b } @a;
493493
$$r = "z";
494494
is ("@a", "3 4 5", "RT #128340");
495-
}
496495

497-
# in-place sorting of weak references
498-
SKIP: {
499-
skip_if_miniperl("no dynamic loading on miniperl, no extension Scalar::Util", 1);
500-
require Scalar::Util;
501-
my @a = map { \(my $dummy = $_) } qw(c a d b);
502-
my $r = $a[1];
503-
Scalar::Util::weaken($a[1]);
504-
@a = sort { $$a cmp $$b } @a;
505-
undef $r;
506-
ok defined $a[0] && ${$a[0]} eq 'a', "in-place sort strengthens weak references";
507496
}
508497

509498
# Test optimisations of reversed sorts. As we now guarantee stability by

0 commit comments

Comments
 (0)