Change 27986 by [EMAIL PROTECTED] on 2006/04/27 23:15:02
[perl #39012] another REIFY bug
Affected files ...
... //depot/perl/scope.c#189 edit
... //depot/perl/t/op/local.t#32 edit
Differences ...
==== //depot/perl/scope.c#189 (text) ====
Index: perl/scope.c
--- perl/scope.c#188~27805~ 2006-04-14 13:44:27.000000000 -0700
+++ perl/scope.c 2006-04-27 16:15:02.000000000 -0700
@@ -845,9 +845,9 @@
value = (SV*)SSPOPPTR;
i = SSPOPINT;
av = (AV*)SSPOPPTR;
+ ptr = av_fetch(av,i,1);
if (!AvREAL(av) && AvREIFY(av)) /* undo reify guard */
SvREFCNT_dec(value);
- ptr = av_fetch(av,i,1);
if (ptr) {
sv = *(SV**)ptr;
if (sv && sv != &PL_sv_undef) {
==== //depot/perl/t/op/local.t#32 (xtext) ====
Index: perl/t/op/local.t
--- perl/t/op/local.t#31~27638~ 2006-03-30 12:55:17.000000000 -0800
+++ perl/t/op/local.t 2006-04-27 16:15:02.000000000 -0700
@@ -4,7 +4,7 @@
chdir 't' if -d 't';
require './test.pl';
}
-plan tests => 113;
+plan tests => 114;
my $list_assignment_supported = 1;
@@ -415,3 +415,15 @@
is($h{"\243"}, "pound");
is($h{"\302\240"}, "octects");
}
+
+# [perl #39012] localizing @_ element then shifting frees element too # soon
+
+{
+ my $x;
+ my $y = bless [], 'X39012';
+ sub X39012::DESTROY { $x++ }
+ sub { local $_[0]; shift }->($y);
+ ok(!$x, '[perl #39012]');
+
+}
+
End of Patch.