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 Jack Zhou
Recipients Jack Zhou
Date 2016-04-08.19:50:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1460145033.33.0.165294517839.issue26716@psf.upfronthosting.co.za>
In-reply-to
Content
According to PEP 475, standard library modules should handle EINTR, but this appears to not be the case for the fcntl module.

Test script:


import fcntl
import signal
import os


def handle_alarm(signum, frame):
    print("Received alarm in process {}!".format(os.getpid()))


child = os.fork()
if child:
    signal.signal(signal.SIGALRM, handle_alarm)
    signal.alarm(1)
    with open("foo", "w") as f:
        print("Locking in process {}...".format(os.getpid()))
        fcntl.flock(f, fcntl.LOCK_EX)
        print("Locked in process {}.".format(os.getpid()))
        os.waitpid(child, 0)
else:
    signal.signal(signal.SIGALRM, handle_alarm)
    signal.alarm(1)
    with open("foo", "w") as f:
        print("Locking in process {}...".format(os.getpid()))
        fcntl.flock(f, fcntl.LOCK_EX)
        print("Locked in process {}.".format(os.getpid()))
History
Date User Action Args
2016-04-08 19:50:33Jack Zhousetrecipients: + Jack Zhou
2016-04-08 19:50:33Jack Zhousetmessageid: <1460145033.33.0.165294517839.issue26716@psf.upfronthosting.co.za>
2016-04-08 19:50:33Jack Zhoulinkissue26716 messages
2016-04-08 19:50:33Jack Zhoucreate