[Python-Dev] Proposal for new core module: UserFIle (original) (raw)
Guido van Rossum guido at python.org
Fri Dec 12 19:07:03 EST 2003
- Previous message: [Python-Dev] Proposal for new core module: UserFIle
- Next message: [Python-Dev] Proposal for new core module: UserFIle
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> 1. What is the purpose of hiding EINTR?
My code uses a lot of interrupts (SIGALRM, SIGIO, SIGCHLD, ...) and I almost always need to trap and restart interrupted system calls. So I made that wrapper. Nearly all I/O uses it. In fact, I think it should be the default behavior....
Here we may have a fundamental disagreement. In my view it is impossible to write correct code when signal handlers can run any time, and therefore I have given up on using signals at all.
Everything you do with signals can also be done without signals, and usually more portably. (You may have to use threads.)
Making read and write ignore EINTR doesn't solve all signal-related problems, it just makes them rarer, thereby increasing the possibility that despite thorough testing your code will be incorrect, and you will face irreproducible but real error reports from the field.
Also note that Python takes non-Posix systems very seriously, and augmentations to standard object types that only work on Posix are generally rejected. (isatty() is an old wart and would these days probably not have been accepted as a file object method.)
--Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] Proposal for new core module: UserFIle
- Next message: [Python-Dev] Proposal for new core module: UserFIle
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]