[Python-ideas] Add "goto fail" to Python?

Georg Brandl g.brandl at gmx.net
Thu Mar 6 22:36:23 CET 2014


Am 06.03.2014 11:11, schrieb Nick Coghlan:
> 
> On 6 Mar 2014 13:55, "Sturla Molden"
> <sturla.molden at gmail.com
> <mailto:sturla.molden at gmail.com>> wrote:
>>
>> "goto fail" is a well-known error handling mechanism in open source software,
> widely reputed for its robusteness:
>>
>>
> http://opensource.apple.com/source/Security/Security-55471/libsecurity_ssl/lib/sslKeyExchange.c
>>
>>
> https://www.gitorious.org/gnutls/gnutls/source/6aa26f78150ccbdf0aec1878a41c17c41d358a3b:lib/x509/verify.c
>>
>> I believe Python needs to add support for this superior paradigm.
> 
> Unfortunately, we can't throw stones about those, since we currently have
> hostname matching off by default and expect developers to turn it on.

And on another level, we use the same error handling method in C code
(which is not bad per se of course).  The literal code "goto fail;" actually
occurs about 200 times in the CPython sources :)

Aaand... we also don't have a policy to always use braces...

Georg



More information about the Python-ideas mailing list