Ralf Schmitt added the comment:
PyOS_setsig in pythonrun.c now calls siginterrupt(sig, 1) (in Python
2.4.4/Python 2.5.1, but not in Python 2.3). So you should be able to
timeout the system calls with a signal.alarm call.
However, having siginterrupt available would still be useful.
I have some patches for the signal module and will clean them up in some
days and attach to this bug.
Here's an implementation using ctypes:
def siginterrupt(signum, flag):
"""change restart behavior when a function is interrupted by the
specified signal. see man siginterrupt.
"""
import ctypes
import sys
if flag:
flag = 1
else:
flag = 0
if sys.platform=='darwin':
libc = ctypes.CDLL("libc.dylib")
elif sys.platform=='linux2':
libc = ctypes.CDLL("libc.so.6")
else:
libc = ctypes.CDLL("libc.so")
if libc.siginterrupt(signum, flag)!=0:
raise OSError("siginterrupt failed")
----------
nosy: +schmir
_____________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1089358>
_____________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com