Subject: | Python overrides Perl signal handlers |
use Inline;
my $code = 'print "python called"';
Inline->bind(Python => $code);
#$SIG{INT} = 'DEFAULT';
while (1) {
}
__END__
When you run the script (MacOS X, MacPorts Python 2.7, Inline-Python 0.50, perl 5.22), it ignores Ctrl-C. If you restore the signal handler after compiling(!) the Python code, the script works as expected.
The reason probably is that the Python interpreter catches SIGINT so that it can print out a stack trace and write "KeyboardInterrupt". This could be hard to prevent but the behavior should be at least documented.