This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author telmich
Recipients pitrou, telmich
Date 2012-03-09.15:05:59
SpamBayes Score 1.44538e-10
Marked as misclassified No
Message-id <1331305560.67.0.813871956785.issue14228@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2012-03-09 15:06:00telmichsetrecipients: + telmich, pitrou
2012-03-09 15:06:00telmichsetmessageid: <1331305560.67.0.813871956785.issue14228@psf.upfronthosting.co.za>
2012-03-09 15:06:00telmichlinkissue14228 messages
2012-03-09 15:05:59telmichcreate