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 exarkun
Recipients exarkun, neologix, r.david.murray, spiv
Date 2010-04-15.14:06:27
SpamBayes Score 3.8857806e-16
Marked as misclassified No
Message-id <1271340389.49.0.446081502056.issue8354@psf.upfronthosting.co.za>
In-reply-to
Content
> Will the modified test fail on platforms that don't define HAVE_SIGACTION?

Only if they also have siginterrupt, which seems unlikely (as neologix explained).  The implemented behavior on such platforms is unmodified from current trunk, while the test requires new behavior.

I think it's probably worth testing this new behavior separately from the test for the existing behavior anyway, for the sake of clarity.  If it turns out there's a platform with siginterrupt but not sigaction, then that'll also let the test be skipped there, which is nice (though this case seems unlikely to come up).

I'm not exactly sure how we will know if it is expected to fail, though.  I don't think `HAVE_SIGACTION` is exposed nicely to Python right now.  Perhaps the signal module should make this information available (it's somewhat important now, as it will mean the difference between a nicely working signal.siginterrupt and a not-so-nicely working one).

This quirk probably also bears a mention in the siginterrupt documentation.

A few other thoughts on the code nearby:

  * There seems to be no good reason to special case SIGCHLD in signal_handler.  The comment about infinite recursion has no obvious interpretation to me.  Fortunately, this is irrelevant on platforms with sigaction, because the handler remains installed anyway!

  * The distance between the new #ifndef HAVE_SIGACTION check and the corresponding #ifdef HAVE_SIGACTION in pythonrun.c is somewhat unfortunate.  Someone could very easily change the logic in PyOS_setsig and disturb this relationship.  I'm not sure how this could best be fixed.  A general idea which presents itself is that both of these pieces of code could use a new identifier to make this choice, and that identifier could be named/documented such that it is obvious that it is used in two different places which must be kept synchronized.  Or, some more comments in both places might help.  It seems likely that the remaining SIGCHLD check in handle_signal is only there because whoever updated PyOS_setsig to use sigaction didn't know about it/remember it.

Aside from those points, the fix seems correct and good.
History
Date User Action Args
2010-04-15 14:06:29exarkunsetrecipients: + exarkun, spiv, r.david.murray, neologix
2010-04-15 14:06:29exarkunsetmessageid: <1271340389.49.0.446081502056.issue8354@psf.upfronthosting.co.za>
2010-04-15 14:06:28exarkunlinkissue8354 messages
2010-04-15 14:06:27exarkuncreate