Author pitrou
Recipients amaury.forgeotdarc, gregory.p.smith, isandler, pitrou
Date 2010-11-29.18:50:38
SpamBayes Score 4.37455e-08
Marked as misclassified No
Message-id <1291056635.8671.38.camel@localhost.localdomain>
In-reply-to <1290994960.93.0.0578896129584.issue10478@psf.upfronthosting.co.za>
Content
> Would avoiding PyErr_CheckSignals() while the file object is in
> inconsistent state be a reasonable alternative?

No, because we'd like IO operations to be interruptible by the user
(e.g. pressing Ctrl-C) when they would otherwise block indefinitely.

> I am guessing that it's not that uncommon for a signal handler to need
> IO (e.g to log a signal).

In C, it is recommended that signal handlers be minimal. In Python,
there is no explicit recommendation but, given they execute
semi-asynchronously, I personally wouldn't put too much code in them :)

That said, there's no problem doing IO as long as you're not doing
reentrant calls to the *same* file object. I agree that for logging this
is not always practical...

> If making IO safer is not an option, then I think, this limitation
> needs to be documented (especially, given that this seems to be a
> behavior change from Python 2.x).

Perhaps the IO documentation needs an "advanced topics" section. I'll
see if I get some time.
History
Date User Action Args
2010-11-29 18:50:40pitrousetrecipients: + pitrou, gregory.p.smith, isandler, amaury.forgeotdarc
2010-11-29 18:50:38pitroulinkissue10478 messages
2010-11-29 18:50:38pitroucreate