Change 30627 by [EMAIL PROTECTED] on 2007/03/18 23:43:05

        When restoring localised values, call set only on container magic.
        Avoids (among other things), localised pos index being trashed at
        scope exit.

Affected files ...

... //depot/perl/mg.c#482 edit
... //depot/perl/t/op/pos.t#6 edit

Differences ...

==== //depot/perl/mg.c#482 (text) ====
Index: perl/mg.c
--- perl/mg.c#481~30624~        2007-03-18 16:17:04.000000000 -0700
+++ perl/mg.c   2007-03-18 16:43:05.000000000 -0700
@@ -271,6 +271,8 @@
            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);
     }

==== //depot/perl/t/op/pos.t#6 (xtext) ====
Index: perl/t/op/pos.t
--- perl/t/op/pos.t#5~27286~    2006-02-23 08:24:19.000000000 -0800
+++ perl/t/op/pos.t     2007-03-18 16:43:05.000000000 -0700
@@ -24,10 +24,7 @@
 $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);
End of Patch.

Reply via email to