<p dir="ltr"><br>
On 6 Mar 2014 13:55, "Sturla Molden" <<a href="mailto:sturla.molden@gmail.com">sturla.molden@gmail.com</a>> wrote:<br>
><br>
> "goto fail" is a well-known error handling mechanism in open source software, widely reputed for its robusteness:<br>
><br>
> <a href="http://opensource.apple.com/source/Security/Security-55471/libsecurity_ssl/lib/sslKeyExchange.c">http://opensource.apple.com/source/Security/Security-55471/libsecurity_ssl/lib/sslKeyExchange.c</a><br>
><br>
> <a href="https://www.gitorious.org/gnutls/gnutls/source/6aa26f78150ccbdf0aec1878a41c17c41d358a3b:lib/x509/verify.c">https://www.gitorious.org/gnutls/gnutls/source/6aa26f78150ccbdf0aec1878a41c17c41d358a3b:lib/x509/verify.c</a><br>
><br>
> I believe Python needs to add support for this superior paradigm.</p>
<p dir="ltr">Unfortunately, we can't throw stones about those, since we currently have hostname matching off by default and expect developers to turn it on.</p>
<p dir="ltr">That needs to change, but there are a few thorny practical issues to sort out in order to get there (Christian Heimes has been working through several of them).</p>
<p dir="ltr">Cheers,<br>
Nick.<br></p>
<p dir="ltr">><br>
> It would involve a new keyword "fail" and some means of goto'ing to it. I suggest "raise to fail":<br>
><br>
> if (some_error):<br>
> raise to fail<br>
><br>
> fail:<br>
> <error handling code><br>
><br>
> Unless there are many objections, this fantastic idea might be submitted in a (short) PEP somewhere around the beginning of next month.<br>
><br>
> There is some obvious overlap with the rejected "goto PEP" (PEP 3163) and the Python 2.3 goto module. However, the superiority of goto fail as error generation and error handling paradigm has since then been thoroughly proven.<br>
><br>
> <a href="http://legacy.python.org/dev/peps/pep-3136/">http://legacy.python.org/dev/peps/pep-3136/</a><br>
> <a href="http://entrian.com/goto/download.html">http://entrian.com/goto/download.html</a><br>
><br>
><br>
> Regards,<br>
> Sturla Molden<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
> Python-ideas mailing list<br>
> <a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/python-ideas">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
> Code of Conduct: <a href="http://python.org/psf/codeofconduct/">http://python.org/psf/codeofconduct/</a><br>
</p>