summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2023-03-01 14:39:17 +0000
committerDavid Mitchell <davem@iabyn.com>2023-03-01 14:39:17 +0000
commita769d3e640ceecd7ce719115d3f36d2194247282 (patch)
treef76632a73f743901261e7684d7002e69bafc8734
parent1bc6b32c00831fcbf45413bd1e7d5ea44bff81ab (diff)
downloadperl-a769d3e640ceecd7ce719115d3f36d2194247282.tar.gz
eval_sv(): improve code comment
Explain in detail why the return arg on the stack from the eval can't be NULL on successful compilation. (Spotted by Hugo)
-rw-r--r--perl.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/perl.c b/perl.c
index ad941061bb..54afc2c6fb 100644
--- a/perl.c
+++ b/perl.c
@@ -3259,7 +3259,14 @@ Perl_eval_sv(pTHX_ SV *sv, I32 flags)
if (!*PL_stack_sp) {
/* In the presence of the OPpEVAL_EVALSV flag,
* pp_entereval() pushes a NULL pointer onto the stack to
- * indicate compilation failure */
+ * indicate compilation failure. Otherwise, the top slot on
+ * the stack will be a non-NULL pointer to whatever scalar or
+ * list value(s) the eval returned. In void context it will
+ * be whatever our caller has at the top of stack at the time,
+ * or the &PL_sv_undef guard at PL_stack_base[0]. Note that
+ * NULLs are not pushed on the stack except in a few very
+ * specific circumstances (such as this) to flag something
+ * special. */
PL_stack_sp--;
goto fail;
}