develooper Front page | perl.perl5.porters | Postings from July 2016

Re: Confused by eval behavior

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
July 3, 2016 21:28
Subject:
Re: Confused by eval behavior
Message ID:
20160703212822.GL17054@iabyn.com
On Sat, Jul 02, 2016 at 10:08:36PM +1200, Kent Fredric wrote:
> On 2 July 2016 at 21:37, Andreas Koenig
> <andreas.koenig.7os6VVqR@franz.ak.mind.de> wrote:
> > I'd vote for reverting the change and putting it in a branch until
> > Variable::Magic has got the right medicine.
> 
> 
> +1: Variable::Magic not being broken very much should be a blocking condition.

Now reverted with v5.25.2-89-gcc040a9

The failing Variable::Magic test can be reduced to:

    use Variable::Magic qw<wizard cast>;

    my $wiz2 = wizard;
    my $wiz1 = wizard free => sub { warn "recasting\n"; &cast($_[0], $wiz2); die; };

    eval {
     my $v = do { my $val = 123; \$val };
     &cast($v, $wiz1);
    };

When $v goes out scope, the free magic method is called, which attached
new magic then dies. vmg_call_sv catches the error, then croaks.
The croak calls die_unwind, which now does FREETMPS, which triggers
another call to the free method, and so it recurses infinitely.

I haven't looked closely to see what is being freed by the FREETMPS and
why.








-- 
Any [programming] language that doesn't occasionally surprise the
novice will pay for it by continually surprising the expert.
   -- Larry Wall

Thread Previous | Thread Next


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