From: Dave Mitchell Date: Sun, 18 Mar 2007 23:43:05 +0000 (+0000) Subject: When restoring localised values, call set only on container magic. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e7cbf6c66722616e50aa4cda71d48adf3ae55201;p=p5sagit%2Fp5-mst-13.2.git When restoring localised values, call set only on container magic. Avoids (among other things), localised pos index being trashed at scope exit. p4raw-id: //depot/perl@30627 --- diff --git a/mg.c b/mg.c index 2f2d5ba..6966f9c 100644 --- a/mg.c +++ b/mg.c @@ -271,6 +271,8 @@ Perl_mg_set(pTHX_ SV *sv) mg->mg_flags &= ~MGf_GSKIP; /* setting requires another read */ (SSPTR(mgs_ix, MGS*))->mgs_flags = 0; } + if (PL_localizing == 2 && !S_is_container_magic(mg)) + continue; if (vtbl && vtbl->svt_set) CALL_FPTR(vtbl->svt_set)(aTHX_ sv, mg); } diff --git a/t/op/pos.t b/t/op/pos.t index 0c0de06..c3abfbe 100755 --- a/t/op/pos.t +++ b/t/op/pos.t @@ -24,10 +24,7 @@ is(f(pos($x)), 4); $x = "test string?"; $x =~ s/\w/pos($x)/eg; is($x, "0123 5678910?"); -TODO: { - $x = "123 56"; $x =~ / /g; - is(pos($x), 4); - { local $x } - local $TODO = "RT #1716: search position reset after 'local' save/restore"; - is(pos($x), 4); -} +$x = "123 56"; $x =~ / /g; +is(pos($x), 4); +{ local $x } +is(pos($x), 4);