[ python-Bugs-1326841 ] SIGALRM alarm signal kills interpreter
SourceForge.net
noreply at sourceforge.net
Sat Oct 15 17:53:04 CEST 2005
Bugs item #1326841, was opened at 2005-10-14 16:48
Message generated for change (Comment added) made by loewis
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1326841&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Demos and Tools
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: paul rubin (phr)
Assigned to: Nobody/Anonymous (nobody)
Summary: SIGALRM alarm signal kills interpreter
Initial Comment:
This may be similar to #210641. Example (Python 2.4.1,
Fedora Core 4 GNU/Linux):
sh-3.00$ python
Python 2.4.1 (#1, May 16 2005, 15:19:29)
[GCC 4.0.0 20050512 (Red Hat 4.0.0-5)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import signal
>>> signal.alarm(1) # 1 second passes...
0
>>> Alarm clock
sh-3.00$ # python has exited
Doing the same thing in IDLE results in the subprocess
restarting.
IMO the correct behavior would be to raise an exception
that the outer shell would catch.
----------------------------------------------------------------------
>Comment By: Martin v. Löwis (loewis)
Date: 2005-10-15 17:53
Message:
Logged In: YES
user_id=21627
This is not a bug. It is documented that way: the default
handler is SIG_DFL, which in turn does the system default
for the signal. For Sigalarm, it is to terminate the process.
If you want an exception raised, you need to install a
signal handler:
>>> def doalarm(signum,frame):
... raise "alarm"
...
>>> signal.signal(signal.SIGALRM, doalarm)
<function doalalarm at 0xb7d897d4>
>>> signal.alarm(3)
0
>>>
Traceback (most recent call last):
File "<stdin>", line 0, in ?
File "<stdin>", line 2, in doalarm
alarm
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1326841&group_id=5470
More information about the Python-bugs-list
mailing list