Issue 8241: py2_test_grammar.py contains invalid syntax for 2.6 - Python tracker

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: loewis Nosy List: benjamin.peterson, ggenellina, gombiuda, loewis
Priority: normal Keywords: patch

Created on 2010-03-27 00:48 by ggenellina, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
py2_test_grammar.patch gombiuda, 2010-04-11 04:29 Fix `with statement` syntax invalid problem in py2_test_grammar.py
Messages (6)
msg101779 - (view) Author: Gabriel Genellina (ggenellina) Date: 2010-03-27 00:48
Lib\lib2to3\tests\data\py2_test_grammar.py, in test_with_statement, requires a variant of the with statement (multiple targets) that is not available in Python 2.6.  Compiling py2_test_grammar.py raises a SyntaxError.  This makes the 2.6.5 installer exit with an error message when asked to pre-compile all .pyc files, as reported in issue6716.

The fix is simply to remove the last three 'with' statements in function test_with_statement, around line 923 in Lib\lib2to3\tests\data\py2_test_grammar.py, as this is invalid code for this Python version.
msg101814 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-03-27 01:06
The correct thing to do is actually to ignore py2_test_grammar.py when compiling the pyc files.
msg102809 - (view) Author: Gombiuda Jiang (gombiuda) Date: 2010-04-11 04:29
I have upload a patch for this problem by just removing the lines as Gabriel said.

Please check it out. Thanks.
msg102815 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-04-11 08:25
Benjamin, ISTM that the tests in lib2to3/tests/data/py2_test_grammar aren't run at all, as part of regrtest. If so, the entire file could be removed.
msg102836 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-04-11 14:20
2010/4/11 Martin v. Löwis <report@bugs.python.org>:
>
> Martin v. Löwis <martin@v.loewis.de> added the comment:
>
> Benjamin, ISTM that the tests in lib2to3/tests/data/py2_test_grammar aren't run at all, as part of regrtest. If so, the entire file could be removed.

True, but then it would become out of sync with the other branches.
The tests aren't run in the trunk either, but we keep the file there.
msg112824 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-08-04 15:47
I have now fixed this with r83721, by excluding the file from compileall.