[issue14228] SIGINT (Ctrl-C) not caught at startup

telmich report at bugs.python.org
Fri Mar 9 16:06:00 CET 2012


telmich <nico-bugs.python.org at schottelius.org> added the comment:

You are right, there is no different behaviour as parent or child in general.

I used this example python => shell => python, because it is actually being used like this in cdist (first link in the first post).

The problem arises there, because python is called many (some thousand) times, depending on the configuration, thus you see the problem very often.

This is indeed a general problem, but you cannot easily trigger it in one python process, because the race condition is hard to trigger manually.

Thus the provided use case (running python 1000 times from shell scripts) is very realistic in a typical cdist run.

For demonstration, you can run ./shellpart.sh directly, press ctrl-c and see that you'll get a traceback, although all possible code is protected from the exception.

But (in that's the point) it is possible in user code to catch this exception.

I should probably rephrase the title to

"It is impossible to catch sigint on startup in python code"

Hope this makes things more clear.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14228>
_______________________________________


More information about the Python-bugs-list mailing list