summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pp_ctl.c13
-rw-r--r--t/comp/retainedlines.t11
2 files changed, 16 insertions, 8 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index f3e4f29f8f..68c22ff490 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3686,12 +3686,13 @@ S_doeval_compile(pTHX_ U8 gimme, CV* outside, U32 seq, HV *hh)
CALL_BLOCK_HOOKS(bhk_eval, saveop);
- /* note that yyparse() may raise an exception, e.g. C<BEGIN{die}>,
- * so honour CATCH_GET and trap it here if necessary */
-
-
+ /* we should never be CATCH_GET true here, as our immediate callers should
+ * always handle that case. */
+ assert(!CATCH_GET);
/* compile the code */
- yystatus = (!in_require && CATCH_GET) ? S_try_yyparse(aTHX_ GRAMPROG) : yyparse(GRAMPROG);
+ yystatus = (!in_require)
+ ? S_try_yyparse(aTHX_ GRAMPROG)
+ : yyparse(GRAMPROG);
if (yystatus || PL_parser->error_count || !PL_eval_root) {
PERL_CONTEXT *cx;
@@ -4578,6 +4579,8 @@ PP(pp_entereval)
if (CATCH_GET)
return docatch(Perl_pp_entereval);
+ assert(!CATCH_GET);
+
gimme = GIMME_V;
was = PL_breakable_sub_gen;
saved_delete = FALSE;
diff --git a/t/comp/retainedlines.t b/t/comp/retainedlines.t
index 35f1de0d15..2a846cecae 100644
--- a/t/comp/retainedlines.t
+++ b/t/comp/retainedlines.t
@@ -6,7 +6,7 @@
# we've not yet verified that use works.
# use strict;
-print "1..75\n";
+print "1..98\n";
my $test = 0;
sub failed {
@@ -101,7 +101,10 @@ for my $sep (' ', "\0") {
my $prog = "sub $name {
'This is $name'
}
-1 +
+# 10 errors to triger a croak during compilation.
+1 +; 1 +; 1 +; 1 +; 1 +;
+1 +; 1 +; 1 +; 1 +; 1 +;
+1 +; # and one more for good measure.
";
eval $prog and die;
@@ -119,7 +122,9 @@ foreach my $flags (0x0, 0x800, 0x1000, 0x1800) {
# This is easier if we accept that the guts eval will add a trailing \n
# for us
my $prog = "1 + 1 + 1\n";
- my $fail = "1 + \n";
+ my $fail = "1 +;\n" x 11; # we need 10 errors to trigger a croak during
+ # compile, we add an extra one just for good
+ # measure.
is (eval $prog, 3, 'String eval works');
if ($flags & 0x800) {