Package: python2.6
Version: 2.6.6-8+b1

While I was testing the results of SIGINT during Python startup I
observed the following:

 zealot:~> spongex
 ^C
 zealot:~> 'import site' failed; use -v for traceback
 No command 'spongex' found, did you mean:
  Command 'sponge' from package 'moreutils' (main)
 spongex: command not found

I typed "spongex" and hit return and almost immediately pressed ^C.  I
had 9 copies of "while true; do :; done &" running, to make it more
likely that I would lose interesting races.

As you can see the error message is wrong.  It appears that some part
of the Python startup code says:

    try:
        import site
    except e:
        print >>sys.stderr, "'import site' failed blah blah"

This is of course a broken exception-handling pattern.

Failure to "import site" should print a better message and not throw
away information about the actual exception.  At the very least, only
specific exceptions should be trapped.

This is not specific to KeyboardInterrupt.  It's true that a
KeyboardInterrupt exception should not generate the message above, and
that Python's default handling of KeyboardInterrupt is the subject of
a separate bug report I have just submitted; but note that even if
that bug is fixed somehow other "unexpected" exceptions (NameError,
SyntaxError, etc.) should probably not be handled this way either.

Thanks,
Ian.

-- 
Ian Jackson                  personal email: <ijack...@chiark.greenend.org.uk>
These opinions are my own.        http://www.chiark.greenend.org.uk/~ijackson/
PGP2 key 1024R/0x23f5addb,     fingerprint 5906F687 BD03ACAD 0D8E602E FCF37657



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to