Change 32933 by [EMAIL PROTECTED] on 2008/01/09 23:57:36

        seen_eval regex field wasn't getting cloned

Affected files ...

... //depot/perl/regcomp.c#647 edit
... //depot/perl/t/op/threads.t#16 edit

Differences ...

==== //depot/perl/regcomp.c#647 (text) ====
Index: perl/regcomp.c
--- perl/regcomp.c#646~32932~   2008-01-09 15:26:14.000000000 -0800
+++ perl/regcomp.c      2008-01-09 15:57:36.000000000 -0800
@@ -9458,7 +9458,6 @@
 
     ret->mother_re      = NULL;
     ret->gofs = 0;
-    ret->seen_evals = 0;
 }
 #endif /* PERL_IN_XSUB_RE */
 

==== //depot/perl/t/op/threads.t#16 (text) ====
Index: perl/t/op/threads.t
--- perl/t/op/threads.t#15~32745~       2007-12-27 12:33:55.000000000 -0800
+++ perl/t/op/threads.t 2008-01-09 15:57:36.000000000 -0800
@@ -16,7 +16,7 @@
        exit 0;
      }
 
-     plan(12);
+     plan(13);
 }
 
 use strict;
@@ -169,4 +169,21 @@
 # tests in threads don't get counted, so
 curr_test(curr_test() + 2);
 
+
+# the seen_evals field of a regexp was getting zeroed on clone, so
+# within a thread it didn't  know that a regex object contrained a 'safe'
+# re_eval expression, so it later died with 'Eval-group not allowed' when
+# you tried to interpolate the object
+
+sub safe_re {
+    my $re = qr/(?{1})/;       # this is literal, so safe
+    eval { "a" =~ /$re$re/ };  # interpolating safe values, so safe
+    ok($@ eq "", 'clone seen-evals');
+}
+threads->new(\&safe_re)->join();
+
+# tests in threads don't get counted, so
+curr_test(curr_test() + 1);
+
+
 # EOF
End of Patch.

Reply via email to