Skip Menu |

This queue is for tickets about the Syntax-Feature-Try CPAN distribution.

Report information
The Basics
Id: 112298
Status: resolved
Priority: 0/
Queue: Syntax-Feature-Try

People
Owner: tomas.zemres [...] gmail.com
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.003
Fixed in: 1.005



Subject: Tests fail with perl 5.23.8
With perl 5.23.8 I see the following test problems: # Failed test 'finally is called in right order' # at t/finally.t line 111. # Structures begin differing at: # $got->[7] = Does not exist # $expected->[7] = 'after' # Looks like you failed 1 test of 9. t/finally.t ....................... # Failed test 'nested try/catch is working' # at t/nested.t line 33. # Structures begin differing at: # $got->[5] = Does not exist # $expected->[5] = 'done' # Looks like you failed 1 test of 3. t/nested.t ........................
From: davem [...] iabyn.com
On Mon Feb 22 16:13:37 2016, SREZIC wrote: Show quoted text
> With perl 5.23.8 I see the following test problems:
[...] This is because starting with perl-5.23.8, call_sv(G_VOID) does what it's documented to do, and returns no args on the stack (formerly it would leave whatever the last statement put on the stack there). This rather messes with the IS_END_OF_BLOCK() mechanism in run_block() for determining whether the block successfully ran to completion. For example this: use syntax 'try'; sub f { print "f called\n"; try { 1; } finally { 1; } print "OK, end of f() seen\n"; }; f(); $x = f(); outputs, in 5.23.8: f called f called OK, end of f() seen This is because the try block is called in the same context that f() is called in, so when f() is called in void context, no guard SV is left on the stack. Incidentally this context selection seems wrong to me: the Try docs don't seem to indicate what context the try/catch/finally blocks are called in, but using the context that the enclosing sub is called in seems just wrong. Anyway regardless of what context the blocks should be called in, since its probably legitimate to call them in void context, the IS_END_OF_BLOCK() trick isn't going to work any more. Perhaps instead Try should append a couple of ops that do the equivalent of $Syntax::Feature::Try::_GUARD_++, say, which can be tested for afterwards???
From: davem [...] iabyn.com
PS - I could'nt build Try with a debugging perl. The little attached patch fixes that.
Subject: 0001-Syntax-Feature-Try-OP_RETURN-is-a-list-not-un-op.patch
From 79d51d925e6a27764123a8e6693cd52220814613 Mon Sep 17 00:00:00 2001 From: David Mitchell <davem@iabyn.com> Date: Fri, 26 Feb 2016 17:50:05 +0000 Subject: [PATCH] Syntax-Feature-Try: OP_RETURN is a list, not un op So call op_convert_list() rather than newUNOP(). On debugging perls, newUNOP() would trigger an assertion failure. --- Syntax-Feature-Try-1.003/src/try-catch-op.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Syntax-Feature-Try-1.003/src/try-catch-op.c b/Syntax-Feature-Try-1.003/src/try-catch-op.c index a3be8fc..156a3be 100644 --- a/Syntax-Feature-Try-1.003/src/try-catch-op.c +++ b/Syntax-Feature-Try-1.003/src/try-catch-op.c @@ -54,7 +54,8 @@ static OP *my_build_statement_optree(pTHX_ args_op = op_append_elem(OP_LIST, args_op, finally_block_op); call_op = call_sub_op("_statement", args_op); - return_op = newUNOP(OP_RETURN, 0, call_sub_op("_get_return_value", NULL)); + return_op = op_convert_list(OP_RETURN, 0, + call_sub_op("_get_return_value", NULL)); return newCONDOP(0, call_op, return_op, NULL); } -- 2.4.3
Thank you for advice, I fix it when I will have free time for it. Tomas Show quoted text
> This is because starting with perl-5.23.8, call_sv(G_VOID) does what > it's documented to do, and returns no args on the stack (formerly > it would leave whatever the last statement put on the stack there).
RT-Send-CC: davem [...] iabyn.com
On 2016-02-29 05:41:20, tnt wrote: Show quoted text
> Thank you for advice, I fix it when I will have free time for it. > > Tomas >
> > This is because starting with perl-5.23.8, call_sv(G_VOID) does what > > it's documented to do, and returns no args on the stack (formerly > > it would leave whatever the last statement put on the stack there).
Probably the patch needs an #ifdef ... 1.004 is broken for perl < 5.22.