[perl #76026] match variables persist between calls to a sort sub
authorFather Chrysostomos <sprout@cpan.org>
Sun, 12 Dec 2010 02:50:49 +0000 (18:50 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 12 Dec 2010 04:32:13 +0000 (20:32 -0800)
commitad021bfb7f2cc6ff5ff998e4e0efe2ba182cbbd5
treebb77afb224fa810d385f432bbd0745c6f833d2ee
parent4c9d53d59a35f57a9c3f30e6f419076cd0cb676e
[perl #76026] match variables persist between calls to a sort sub

Since, for speed’s sake, pp_sort does not call PUSH/POPBLOCK for
every invocation of a sort subroutine, it fails to restore PL_curpm
after each call (POPBLOCK usually handles that). So the new values of
match vars like $1 when the sub returns are what it sees at the next
invocation.

This commit fixes this by resetting PL_curpm after each call to the
subroutine. There are actually three different functions for this
(S_sortcv*) so they all need modification.
pp_sort.c
t/op/sort.t