[Python-Dev] C bindings calling tmpfile() blocks interrupt signal
Florent Pillet
fpillet at gmail.com
Thu Jul 7 14:17:13 CEST 2005
I discovered an issue on Mac OS X that seems to relate to signal
handling. I have a C binding in which I call the standard tmpfile()
function. After calling it, I can't break Python anymore with CTRL-C.
Investigating the Darwin source code for tmpfile() (and FreeBSD, they
are the same) , I found that the function is mucking with the signals:
http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/stdio/tmpfile.c?rev=1.9&content-type=text/x-cvsweb-markup
Is this considered a Python issue, or an OS issue? I ran a simple test
against the interrupt signal, which didn't show any wrong behavior:
static void intcatcher(int sig) {
printf("Interrupt catched\n");
exit(1);
}
int main(int argc, char **argv) {
signal(SIGINT, intcatcher);
printf("Press CTRL-C to interrupt...\n");
tmpfile();
while (1)
;
return 0;
}
But with my threaded Python code, SIGINT doesn't work anymore after my
binding has called tmpfile().
Florent
--
Florent Pillet http://www.florentpillet.com
Freelance software developer/consultant - Palm OS & Mac OS X
ICQ: 117292463 Skype: callto://florent.pillet
More information about the Python-Dev
mailing list