[issue11650] CTRL-Z causes interpreter exit

Charles-Francois Natali report at bugs.python.org
Wed Mar 23 16:41:01 CET 2011


Charles-Francois Natali <neologix at free.fr> added the comment:

In that case, it's likely due to the way OS-X handles interrupted syscalls.
Under Linux, getchar and friends (actually read with default SA_RESTART) won't return EINTR on (SIGSTOP|SIGTSTP)/SIGCONT.
Under OS-X, it seems that e.g. getchar (read) does return EOF with errno set to EINTR, in which case the interactive interpreter will exit, if errno is not checked.
Out of curiosity, could you try the C snippet:

#include <stdio.h>

int main(int argc, char *argv[])
{
    int c;

    if ((c = getchar()) == EOF) {
        perror("getchar");
    }

    return 0;
}

And interrupt it with CTRL-Z ?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11650>
_______________________________________


More information about the Python-bugs-list mailing list