summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2022-08-29 13:57:58 +0200
committerYves Orton <demerphq@gmail.com>2022-09-05 07:57:17 +0200
commitc304acb49dada68ec331d50f8af45f0dda83ba6a (patch)
tree70b5ae92d3e3c233154bf1d4fb556965509880c5 /pp_ctl.c
parentaeff225d87d2f29d88da7859578fe95761d0a347 (diff)
downloadperl-c304acb49dada68ec331d50f8af45f0dda83ba6a.tar.gz
pp_ctl.c - use try_yyparse() for eval
CATCH_GET is never true in this code, so we never called try_yyparse() which in turn meant we leaked debug data from failed evals. With this in place an eval that dies during compile will always be handled by doeval_comp() properly. This includes changes to t/comp/readlines.t so it tests code that croaks during compile, which used to leak and fail test but was not actually tested. This fixes GH Issue #20161.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c13
1 files changed, 8 insertions, 5 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;