[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup
Geoffrey Bache
report at bugs.python.org
Thu Jun 19 10:04:37 CEST 2008
New submission from Geoffrey Bache <gjb1002 at users.sourceforge.net>:
If a python script receives SIGINT while the interpreter is starting up,
it's possible to get the message "import site failed; use -v for
traceback" printed on standard error and for execution to proceed. It
also seems to be possible to get half-imported modules and for the
script to fail later claiming that something like "os.getenv" doesn't exist.
If I do as instructed and use -v for traceback I get something like:
'import site' failed; traceback:
Traceback (most recent call last):
File "/usr/lib/python2.4/site.py", line 61, in ?
import os
File "/usr/lib/python2.4/os.py", line 683, in ?
import copy_reg as _copy_reg
File "/usr/lib/python2.4/copy_reg.py", line 5, in ?
"""
KeyboardInterrupt
I imagine there exists some code like
try:
import site
except:
sys.stderr.write("import site failed; use -v for traceback\n")
though I couldn't find any. If so, it seems clear that KeyboardInterrupt
needs to be re-raised, or Python's special handler for SIGINT installed
rather later.
----------
components: Interpreter Core
messages: 68392
nosy: gjb1002
severity: normal
status: open
title: Python doesn't handle SIGINT well if it arrives during interpreter startup
versions: Python 2.5
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3137>
_______________________________________
More information about the Python-bugs-list
mailing list