diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-06-26 00:18:03 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-06-26 01:12:10 -0700 |
commit | 20d5dc239d1bc8440adfec25faf617e0e444f64e (patch) | |
tree | 8ebab95b5783396ff210544b5e03d3317dfd7706 /t/op | |
parent | ae3f739188e3ee21fa593cafc28023c533e8d9bf (diff) | |
download | perl-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 't/op')
-rw-r--r-- | t/op/sort.t | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/t/op/sort.t b/t/op/sort.t index ca749a063b..452a66baf7 100644 --- a/t/op/sort.t +++ b/t/op/sort.t @@ -6,7 +6,7 @@ BEGIN { require 'test.pl'; } use warnings; -plan( tests => 177 ); +plan( tests => 178 ); # these shouldn't hang { @@ -770,6 +770,8 @@ cmp_ok($answer,'eq','good','sort subr called from other package'); $fail_msg = q(Modification of a read-only value attempted); cmp_ok(substr($@,0,length($fail_msg)),'eq',$fail_msg,'bug 7567'); + eval { @a=1..3 }; + is $@, "", 'abrupt scope exit turns off readonliness'; } { |