summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-06-26 00:18:03 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-06-26 01:12:10 -0700
commit20d5dc239d1bc8440adfec25faf617e0e444f64e (patch)
tree8ebab95b5783396ff210544b5e03d3317dfd7706 /scope.c
parentae3f739188e3ee21fa593cafc28023c533e8d9bf (diff)
downloadperl-20d5dc239d1bc8440adfec25faf617e0e444f64e.tar.gz
In-place sort should not leave array read-only
$ ./perl -Ilib -e '@a=1..2; eval { @a=sort{die} @a }; warn "ok so far\n"; @a = 1' ok so far Modification of a read-only value attempted at -e line 1. If something goes wrong inside the sort block and it dies, we still need to make sure we turn off the read-only flag on that array.
Diffstat (limited to 'scope.c')
-rw-r--r--scope.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/scope.c b/scope.c
index d2ae04a650..3ac3990fff 100644
--- a/scope.c
+++ b/scope.c
@@ -1228,6 +1228,9 @@ Perl_leave_scope(pTHX_ I32 base)
case SAVEt_PARSER:
parser_free((yy_parser *) ARG0_PTR);
break;
+ case SAVEt_READONLY_OFF:
+ SvREADONLY_off(ARG0_SV);
+ break;
default:
Perl_croak(aTHX_ "panic: leave_scope inconsistency %u", type);
}