[Python-bugs-list] [ python-Bugs-685846 ] raw_input defers alarm signal

SourceForge.net noreply@sourceforge.net
Thu, 13 Feb 2003 02:11:27 -0800


Bugs item #685846, was opened at 2003-02-13 10:11
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=685846&group_id=5470

Category: Python Library
Group: Python 2.2
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.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=685846&group_id=5470