Author tholzer
Recipients flox, gregory.p.smith, meishao, neologix, pitrou, tholzer, vstinner
Date 2014-05-30.01:37:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1401413866.74.0.422427254484.issue20611@psf.upfronthosting.co.za>
In-reply-to
Content
And a test case for smtplib:

import threading
import signal
import os
import smtplib

def go():
    running = True
    pid = os.getpid()

    def killer():
        while running: 
            os.kill(pid, signal.SIGINT)

    signal.signal(signal.SIGINT, lambda x,y: None)
    thread = threading.Thread(target=killer)
    thread.start()

    while 1:
        try:
            smtplib.SMTP('localhost')
        except Exception, ex:
            running = False
            raise
        
if __name__ == '__main__':
    go()

Fails with:

socket.error: [Errno 4] Interrupted system call
History
Date User Action Args
2014-05-30 01:37:47tholzersetrecipients: + tholzer, gregory.p.smith, pitrou, vstinner, flox, neologix, meishao
2014-05-30 01:37:46tholzersetmessageid: <1401413866.74.0.422427254484.issue20611@psf.upfronthosting.co.za>
2014-05-30 01:37:46tholzerlinkissue20611 messages
2014-05-30 01:37:45tholzercreate