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

Re: Confused by eval behavior

Thread Previous | Thread Next
Dave Mitchell
July 3, 2016 21:28
Re: Confused by eval behavior
Message ID:
On Sat, Jul 02, 2016 at 10:08:36PM +1200, Kent Fredric wrote:
> On 2 July 2016 at 21:37, Andreas Koenig
> <> 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

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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About