From 2aabfe8a6165874dd6373e006f0e80d74d5f602c Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Fri, 16 Oct 2015 13:31:57 +0100 Subject: pp_leaveeval: reset stack in VOID context $ perl -Dst -e'eval"1"' Gives: .... ((eval 1):1) leaveeval => (FREED) Change it so that like all the other pp_leavefoo() functions, it does if (gimme == G_VOID) PL_stack_sp = newsp; I can't think of any (non-debugging) perl-level badness the old behaviour can be shown to demonstrate, but best not to have freed values left dangling. This also allows pp_leaveeval() to (like the other pp_leavefoo functions) avoid doing a dSP with the associated unnecessary PUTBACKs and SPAGAINs. Finally, the code to detect a false require is moved to earlier in the function where it's in the same place as the rest of the stack arg processing code. --- ext/XS-APItest/t/call.t | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ext') diff --git a/ext/XS-APItest/t/call.t b/ext/XS-APItest/t/call.t index df98b1a55f..c474639380 100644 --- a/ext/XS-APItest/t/call.t +++ b/ext/XS-APItest/t/call.t @@ -81,7 +81,9 @@ for my $test ( "$description call_pv('f')"); ok(eq_array( [ eval_sv('f(' . join(',',map"'$_'",@$args) . ')', $flags) ], - $expected), "$description eval_sv('f(args)')"); + $flags == G_VOID ? [ 0 ] : $expected + ), + "$description eval_sv('f(args)')"); ok(eq_array( [ call_method('meth', $flags, $obj, @$args) ], $expected), "$description call_method('meth')"); @@ -135,7 +137,9 @@ for my $test ( $expected), "$description G_NOARGS call_pv('f')"); ok(eq_array( [ sub { eval_sv('f(@_)', $flags|G_NOARGS) }->(@$args) ], - $expected), "$description G_NOARGS eval_sv('f(@_)')"); + $flags == G_VOID ? [ 0 ] : $expected + ), + "$description G_NOARGS eval_sv('f(@_)')"); # XXX call_method(G_NOARGS) isn't tested: I'm assuming # it's not a sensible combination. DAPM. -- cgit v1.2.1