exception thrown from I/O interrupted by signal
Donn Cave
donn at u.washington.edu
Wed Nov 20 13:28:43 EST 2002
Quoth Volker Apelt <gq437x at yahoo.de>:
|
| Which exception is thrown from a I/O operation that is
| interrupted by a signal?
|
| Which specification will catch it?
|
| try:
| line = f.readline()
| except WhatIsIt, e:
| print e
The exception will actually be raised by the library function that
you have called, and they each raise their own exception. Optimistically
assuming you have a bona fide file object there, you may specify IOError.
The errno attribute of the exception will match errno.EINTR.
Donn Cave, donn at u.washington.edu
| ----- python lib docu
| _underline_ added by me.
| http://www.python.org/doc/current/lib/module-signal.html
|
| 7.1 signal -- Set handlers for asynchronous events
| # When a signal arrives during an I/O operation, it is _possible_ that the
| I/O operation raises _an_exception_ after the signal handler returns. This
| is dependent on the underlying Unix system's semantics regarding
| interrupted system calls.
More information about the Python-list
mailing list