Bugs item #685846, was opened at 2003-02-13 07:11 Message generated for change (Settings changed) made by facundobatista You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=685846&group_id=5470
Category: Python Library >Group: Python 2.3 Status: Open Resolution: None Priority: 5 Submitted By: paul rubin (phr) Assigned to: Nobody/Anonymous (nobody) Summary: raw_input defers alarm signal Initial Comment: import signal def handle(a,b): print "received signal" signal.signal(signal.SIGALRM, handle) signal.alarm(5) name = raw_input('Please enter your name within 5 seconds: ') waits for input forever instead of getting the signal thrown after 5 seconds. If you wait more than 5 seconds before typing your name, the signal does get handled after you finally enter your input. The workaround of calling sys.stdin.readline() instead of raw_input does the right thing, so something is funny about the raw_input function. ---------------------------------------------------------------------- Comment By: Michael Stone (mbrierst) Date: 2003-03-19 14:51 Message: Logged In: YES user_id=670441 This isn't just a readline problem, it's consistent whether or not readline is used. Patch #706406 attempts to fix this problem in a reasonable manner, but it may not be possible to fix perfectly. Signals always seem pretty hopeless to get really right, and python hardly tries most of the time. (Only handling them in the main thread...) I think raw_input really doesn't WANT to just give up when receiving a signal, so the patch has it give up only when the signal handler throws an exception. ---------------------------------------------------------------------- Comment By: Michael Hudson (mwh) Date: 2003-02-13 08:46 Message: Logged In: YES user_id=6656 I'm 99% sure this is readline's fault. You might be able to test this by hiding the readline.so from the interpreter. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=685846&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com