classification
Title: py2_test_grammar.py contains invalid syntax for 2.6
Type: behavior Stage: needs patch
Components: Installation Versions: Python 2.6
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 2010-08-04 15:47 by loewis. 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.
History
Date User Action Args
2010-08-04 15:47:59loewissetstatus: open -> closed
resolution: fixed
messages: + msg112824
2010-04-11 14:20:02benjamin.petersonsetmessages: + msg102836
2010-04-11 08:25:03loewissetnosy: loewis, ggenellina, benjamin.peterson, gombiuda
messages: + msg102815
components: + Installation, - 2to3 (2.x to 3.x conversion tool)
2010-04-11 04:29:18gombiudasetfiles: + py2_test_grammar.patch

nosy: + gombiuda
messages: + msg102809

keywords: + patch
2010-03-27 01:06:06benjamin.petersonsetassignee: benjamin.peterson -> loewis

messages: + msg101814
nosy: + loewis
2010-03-27 00:50:53ezio.melottisetpriority: normal
assignee: benjamin.peterson

nosy: + benjamin.peterson
stage: needs patch
2010-03-27 00:48:59ggenellinacreate