[docs] [issue30637] Syntax error reported on compile(...), but not on compile(..., ast.PyCF_ONLY_AST)

Hrvoje Nikšić report at bugs.python.org
Tue Jun 13 08:18:03 EDT 2017


Hrvoje Nikšić added the comment:

> The appropriate fix would probably be to add a sentence to the
> `ast.PyCF_ONLY_AST` documentation to say that some syntax errors
> are only detected when compiling the AST to a code object.

Yes, please. I'm not saying the current behavior is wrong (it makes sense that some constructs are legal as AST, but can't be converted into code), I just found it surprising. In other words, we would have found it very useful for the documentation to mention that code generation performs additional checks on the AST that are not performed during the ast.PyCF_ONLY_AST compilation.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30637>
_______________________________________


More information about the docs mailing list