develooper Front page | perl.perl5.porters | Postings from March 2013

[perl #115772] Bleadperl v5.17.5-247-g049bd5f breaks FLORA/Sub-Call-Tail-0.05.tar.gz

From:
Brian Fraser via RT
Date:
March 28, 2013 08:27
Subject:
[perl #115772] Bleadperl v5.17.5-247-g049bd5f breaks FLORA/Sub-Call-Tail-0.05.tar.gz
Message ID:
rt-3.6.HEAD-28177-1364459212-1751.115772-15-0@perl.org
On Sat Nov 17 03:53:42 2012, andreas.koenig.7os6VVqR@franz.ak.mind.de wrote:
> git bisect
> ----------
> commit 049bd5ffd62b73325d4b2e75e59ba04b3569137d
> Author: Father Chrysostomos <sprout@cpan.org>
> Date:   Sun Nov 11 22:16:35 2012 -0800
> 
>     [perl #43077] Make goto &sub leave @_ alone
> 
> diagnostics
> -----------
> t/04_leak.t does not finish at all, and t/01_basic.t fails with:
> 
>   #   Failed test 'reified @_ gets dropped'
>   #   at t/01_basic.t line 103.
>   #          got: 'blah blah'
>   #     expected: 'foo'
> 
>   #   Failed test 'reified @_ recreated'
>   #   at t/01_basic.t line 104.
>   #          got: 'blah blah'
>   #     expected: '42'
>   # Looks like you failed 2 tests of 18.
> 

That commit reworks how pp_goto handles @_ when it is replaced or
reified. A reified @_ will be left untouched, and replacing *_ will
actually propagate the changes:

sub arg { "$_[0]" }
say sub { local *_ = [10]; goto &arg }->(5); #Will print 10 in blead, 5
in 5.16

This patch stops the tests from failing, although it's *not* a solution,
only my half-assed attempt at groking how the module works & what went
wrong. Blame rjbs. Still, maybe it'll shed some light for someone else.

diff --git a/tmp/Sub-Call-Tail-0.05/Tail.xs b/Tail.xs
index 8919811..2028a0e 100644
--- a/tmp/Sub-Call-Tail-0.05/Tail.xs
+++ b/Tail.xs
@@ -145,8 +145,7 @@ try_autoload:
 
     /* abandon @_ if it got reified */
     if (AvREAL(av)) {
-        SvREFCNT_dec(av);
-        av = newAV();
+        CLEAR_ARGARRAY(av);
         AvREIFY_only(av);
 
         cx->blk_sub.argarray = av;

Sub::Call::Tail is over my head, but looks like it just(*) needs to
update the cargo-culted code to take into account the current state of
pp_goto, e.g. in blead the code that the patch modifies has an extra
condition in the if and an else block.

* Probably not 'just'. Dunning—Kruger is rearing its ugly head.

--hugmeir


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=115772



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About