[issue20611] socket.create_connection() doesn't handle EINTR properly

tholzer report at bugs.python.org
Fri May 30 03:37:46 CEST 2014


tholzer added the comment:

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

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20611>
_______________________________________


More information about the Python-bugs-list mailing list