Skip Menu |
 

This queue is for tickets about the Future-AsyncAwait CPAN distribution.

Report information
The Basics
Id: 122796
Status: resolved
Priority: 0/
Queue: Future-AsyncAwait

People
Owner: Nobody in particular
Requestors: leonerd-cpan [...] leonerd.org.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.08
Fixed in: 0.10



Subject: try/finally fails (F:AA + S:K:T)
Download (untitled) / with headers
text/plain 613b
A try/finally (from Syntax::Keyword::Try) fails: async sub with_tryfinally { my $x = "A"; try { await $f; $x .= "B"; } finally { $x .= "C"; } return $x; } This fails with the somewhat-expected TODO: Unsure how to handle savestack entry of 25 at ... (The SAVEt_DESTRUCTOR_X that S:K:T uses to implement PUSHFINALLY has the value 25) However, even if SAVEt_DESTRUCTOR_X is implemented, this test fails semantically, because the `$x` visible inside the `finally` block has become detached from the one shared by the rest of the sub. -- Paul Evans
Download (untitled) / with headers
text/plain 101b
This patch fixes the S:K:T side of the implementation. Will be in S:K:T version 0.07 -- Paul Evans
Subject: rt122796-in-SKT.patch
=== modified file 'lib/Syntax/Keyword/Try.xs' --- lib/Syntax/Keyword/Try.xs 2017-06-05 19:30:04 +0000 +++ lib/Syntax/Keyword/Try.xs 2017-08-13 17:15:09 +0000 @@ -60,17 +60,18 @@ CV *finally = arg; dSP; - if(CvCLONE(finally)) - /* finally is a closure protosub; we have to clone it into a real sub */ - finally = (CV *)sv_2mortal((SV *)cv_clone(finally)); - PUSHMARK(SP); call_sv((SV *)finally, G_DISCARD|G_EVAL|G_KEEPERR); + + SvREFCNT_dec(finally); } static OP *pp_pushfinally(pTHX) { - SAVEDESTRUCTOR_X(&invoke_finally, cSVOP->op_sv); + CV *finally = (CV *)cSVOP->op_sv; + + /* finally is a closure protosub; we have to clone it into a real sub */ + SAVEDESTRUCTOR_X(&invoke_finally, (SV *)cv_clone(finally)); return PL_op->op_next; }
This was fixed by the combination of F:AA 0.10 and S:K:T 0.07 -- Paul Evans


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.