<div dir="ltr">2013/8/30 Charles-François Natali <span dir="ltr"><<a href="mailto:cf.natali@gmail.com" target="_blank">cf.natali@gmail.com</a>></span><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Hello,<br>
<br>
This has been bothering me for years: why don't we properly handle<br>
EINTR, by running registered signal handlers and restarting the<br>
interrupted syscall (or eventually returning early e.g. for sleep)?<br>
<br>
EINTR is really a nuisance, and exposing it to Python code is just pointless.<br></blockquote><div><br></div><div>I agree.</div><div>Is there a way to see in C code where EINTR is not handled?</div><div>Or a method to handle this systematically?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Now some people might argue that some code relies on EINTR to<br>
interrupt a syscall on purpose, but I don't really buy it: it's highly<br>
non-portable (depends on the syscall, SA_RESTART flag...) and subject<br>
to race conditions (it it comes before the syscall or if you get a<br>
partial read/write you'll deadlock).<br>
<br>
Furthermore, the stdlib code base is not consistent: some code paths<br>
handle EINTR, e.g. subprocess, multiprocessing, sock_sendall() does<br>
but not sock_send()...<br>
Just grep for EINTR and InterruptedError and you'll be amazed.<br>
<br>
GHC, the JVM and probably other platforms handle EINTR, maybe it's<br>
time for us too?<br>
<br>
Just for reference, here are some issues due to EINTR popping up:<br>
<a href="http://bugs.python.org/issue17097" target="_blank">http://bugs.python.org/issue17097</a><br>
<a href="http://bugs.python.org/issue12268" target="_blank">http://bugs.python.org/issue12268</a><br>
<a href="http://bugs.python.org/issue9867" target="_blank">http://bugs.python.org/issue9867</a><br>
<a href="http://bugs.python.org/issue7978" target="_blank">http://bugs.python.org/issue7978</a><br>
<a href="http://bugs.python.org/issue12493" target="_blank">http://bugs.python.org/issue12493</a><br>
<a href="http://bugs.python.org/issue3771" target="_blank">http://bugs.pythoto see n.org/issue3771</a><br>
<br>
<br>
cf<br>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-dev" target="_blank">http://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="http://mail.python.org/mailman/options/python-dev/amauryfa%40gmail.com" target="_blank">http://mail.python.org/mailman/options/python-dev/amauryfa%40gmail.com</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Amaury Forgeot d'Arc
</div></div>