From: Dave Mitchell Date: Wed, 9 Jan 2008 23:57:36 +0000 (+0000) Subject: seen_eval regex field wasn't getting cloned X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1db36481d13cc744ff50a6e79d19885d5071f098;p=p5sagit%2Fp5-mst-13.2.git seen_eval regex field wasn't getting cloned p4raw-id: //depot/perl@32933 --- diff --git a/regcomp.c b/regcomp.c index 03d1112..0c503e9 100644 --- a/regcomp.c +++ b/regcomp.c @@ -9458,7 +9458,6 @@ Perl_re_dup_guts(pTHX_ const REGEXP *sstr, REGEXP *dstr, CLONE_PARAMS *param) ret->mother_re = NULL; ret->gofs = 0; - ret->seen_evals = 0; } #endif /* PERL_IN_XSUB_RE */ diff --git a/t/op/threads.t b/t/op/threads.t index 4679929..814b595 100644 --- a/t/op/threads.t +++ b/t/op/threads.t @@ -16,7 +16,7 @@ BEGIN { exit 0; } - plan(12); + plan(13); } use strict; @@ -169,4 +169,21 @@ threads->new(\&matchit, "Pie", qr/pie/i)->join(); # 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