This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
dispatch signals when leaving an eval
authorDavid Mitchell <davem@iabyn.com>
Tue, 19 Apr 2011 13:17:12 +0000 (14:17 +0100)
committerDavid Mitchell <davem@iabyn.com>
Tue, 19 Apr 2011 13:32:42 +0000 (14:32 +0100)
commit011c381477c2b48fc4fbb6c52c59dbd6a21bc7d6
tree05aab26ebb718205ec4c88b59766f50ed0f2fb68
parent53777b0ce48433ad582498a56c60698a8fad29f6
dispatch signals when leaving an eval

Currently PERL_ASYNC_CHECK is only called during scope exit in pp_leavetry
and pp_levaeeval. This means that if the signal handler calls die, the
eval won't catch it.

This broke Sys::AlarmCall's test suite, which was doing the equivalent of

    $SIG{ALRM} = sub { die };
    eval {
alarm(1);
select(undef, undef, undef, 10);
    }
    # expect the die to get caught and $@ set here.

Because the select was the last statement in the block, PERL_ASYNC_CHECK
wasn't called next until the leave_scope at the end of leavetry.
See RT #88774.

The simple fix is to add a PERL_ASYNC_CHECK at the top of
leavetry and leaveeval.
pp_ctl.c
t/op/sigdispatch.t