Message139319
| Author |
kisielk |
| Recipients |
kisielk |
| Date |
2011年06月27日.17:52:09 |
| SpamBayes Score |
1.4619972e-12 |
| Marked as misclassified |
No |
| Message-id |
<1309197130.0.0.320444785748.issue12423@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
It seems that registering a signal handler for SIGABRT doesn't handle the signal from os.abort().
Example code:
import signal, os
import time
def handler(signum, frame):
print "Signal!"
raise Exception()
signal.signal(signal.SIGABRT, handler)
os.abort()
The result is the process still core dumps instead of raising an exception. If instead of os.abort I call time.sleep(10) and then send a kill -ABRT from a shell, the exception is raised as expected.
I tried this with Python 2.6 on Gentoo, 2.7 on FC 14, and 2.6 on OS X 10.6.7 with the same result.
Based on the documentation for os.abort, I would expect this to work:
Generate a SIGABRT signal to the current process. On Unix, the default behavior is to produce a core dump; on Windows, the process immediately returns an exit code of 3. Be aware that programs which use signal.signal() to register a handler for SIGABRT will behave differently. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2011年06月27日 17:52:10 | kisielk | set | recipients:
+ kisielk |
| 2011年06月27日 17:52:09 | kisielk | set | messageid: <1309197130.0.0.320444785748.issue12423@psf.upfronthosting.co.za> |
| 2011年06月27日 17:52:09 | kisielk | link | issue12423 messages |
| 2011年06月27日 17:52:09 | kisielk | create |
|