python reliability with EINTR handling in general modules

Mel Wilson mwilson at
Thu Feb 2 14:42:15 EST 2012

Dennis Lee Bieber wrote:

> On Wed, 1 Feb 2012 23:25:36 -0800 (PST), oleg korenevich
> <void.of.time at> wrote:
>>Thanks for help. In first case all vars is python integers, maybe
>>math.floor is redundant, but i'm afraid that same error with math
>>module call will occur in other places of app, where math is needed.
>>Strange thing here is that math library call is not a system call, and
>>strange exception ValueError (all values have right values) and why in
>>braces i have (4, Interruted system call).
> math.floor() may still be a system call of some sort if access to
> the math processor requires synchronization between processes (that is,
> the math processor/registers are maintained as a separate structure
> apart from the task status during process switches). {Yes -- that is a
> wild hypothesis}

One thing to remember about errno is that C library code will set it to a 
non-zero value when an error is encountered, but (I believe) there's no 
requirement to clear it in the absence of an error.  EINTR might just be 
left over from some long-gone I/O call, then reported "just in case" in 
handling an exception that didn't involve the C library at all.

As a C coder there are times when it's wise to clear errno yourself to make 
sure your code doesn't get fooled.


More information about the Python-list mailing list