This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author schmir
Recipients jvd66, schmir
Date 2007-10-26.09:47:55
SpamBayes Score 0.11646888
Marked as misclassified No
Message-id <>
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
        flag = 0
    if sys.platform=='darwin':
        libc = ctypes.CDLL("libc.dylib")
    elif sys.platform=='linux2':
        libc = ctypes.CDLL("")
        libc = ctypes.CDLL("")

    if libc.siginterrupt(signum, flag)!=0:
        raise OSError("siginterrupt failed")
Date User Action Args
2007-10-26 09:47:57schmirsetspambayes_score: 0.116469 -> 0.11646888
recipients: + schmir, jvd66
2007-10-26 09:47:57schmirsetspambayes_score: 0.116469 -> 0.116469
messageid: <>
2007-10-26 09:47:57schmirlinkissue1089358 messages
2007-10-26 09:47:56schmircreate