[Python-Dev] PEP 7 and braces { .... } on if

Serhiy Storchaka storchaka at gmail.com
Thu Jun 1 02:52:16 EDT 2017


01.06.17 09:36, Benjamin Peterson пише:
> Modern GCC can defend against these kinds of problems. If I introduce a
> "goto fail" bug somewhere in Python, I get a nice warning:
> ../Objects/abstract.c: In function ‘PyObject_Type’:
> ../Objects/abstract.c:35:5: warning: this ‘if’ clause does not guard...
> [-Wmisleading-indentation]
>       if (o == NULL)
>       ^~
> ../Objects/abstract.c:37:9: note: ...this statement, but the latter is
> misleadingly indented as if it is guarded by the ‘if’
>           2 + 3;
>           ^
> 
> This is not to say that simply bracing everything isn't the right way to
> go.

Actually a bug with misleadingly indented statement in CPython sources 
was fixed just few months ago (thanks to modern GCC).



More information about the Python-Dev mailing list