[issue24981] Add a test which uses the ast module to compile the stdlib
Terry J. Reedy
report at bugs.python.org
Fri Sep 4 23:58:22 CEST 2015
Terry J. Reedy added the comment:
The distutils error is a ValueError, which was printed as such before I added 'Exception' to the except statement.
I did not initially catch SyntaxError separately because some are caught during the compile phase. Revised file corrects 'pass' to 'continue' and continues with parse errors also.
Many test/badsyntax files have compile-time syntax errors.
SyntaxError 'await' outside function (badsyntax_async1.py, line 1)
SyntaxError 'yield' inside async function (badsyntax_async6.py, line 2)
SyntaxError from __future__ imports must occur at the beginning of the file (badsyntax_future10.py, line 3)
SyntaxError future feature rested_snopes is not defined (badsyntax_future3.py, line 3)
SyntaxError not a chance (badsyntax_future9.py, line 3)
Attached is a fully recursive version that only report compile errors for non-'badsyntax' files. It takes about 2 seconds more. Output:
C:/programs/Python35/Lib\distutils _msvccompiler.py ValueError None disallowed in expression list
1776 (files compiled)
I excluded site-packages after testing on 3.4 because pylint has bad syntax examples giving a page of error messages.
----------
Added file: http://bugs.python.org/file40360/tem_ast2.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24981>
_______________________________________
More information about the Python-bugs-list
mailing list