This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta for 3480fbaaaea8
[perl5.git] / pp_hot.c
index 67b78f3..1094510 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1789,7 +1789,8 @@ PP(pp_helem)
     const bool localizing = PL_op->op_private & OPpLVAL_INTRO;
     bool preeminent = TRUE;
 
-    assert(SvTYPE(hv) == SVt_PVHV);
+    if (SvTYPE(hv) != SVt_PVHV)
+       RETPUSHUNDEF;
 
     if (localizing) {
        MAGIC *mg;
@@ -2946,8 +2947,12 @@ PP(pp_leavesub)
     PERL_CONTEXT *cx;
     SV *sv;
 
-    if (CxMULTICALL(&cxstack[cxstack_ix]))
+    if (CxMULTICALL(&cxstack[cxstack_ix])) {
+        /* entry zero of a stack is always PL_sv_undef, which
+         * simplifies converting a '()' return into undef in scalar context */
+        assert(PL_stack_sp > PL_stack_base || *PL_stack_base == &PL_sv_undef);
        return 0;
+    }
 
     POPBLOCK(cx,newpm);
     cxstack_ix++; /* temporarily protect top context */