➜

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
标题: py2_test_grammar.py contains invalid syntax for 2.6
类型: behavior Stage: needs patch
Components: Installation Versions: Python 2.6
process
状态: closed Resolution: fixed
Dependencies: 后续:
分配给: loewis 抄送列表: benjamin.peterson, ggenellina, gombiuda, loewis
优先级: normal 关键字: patch

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

文件
文件名 上传时间 Description 编辑
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) 日期: 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) 日期: 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) 日期: 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) 日期: 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) 日期: 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) 日期: 2010-08-04 15:47
I have now fixed this with r83721, by excluding the file from compileall.
历史
日期 用户 动作 参数
2022-04-11 14:56:59admin修改github: 52488
2010-08-04 15:47:59loewis修改状态: open -> closed
resolution: fixed
消息: + msg112824
2010-04-11 14:20:02benjamin.peterson修改消息: + msg102836
2010-04-11 08:25:03loewis修改抄送: loewis, ggenellina, benjamin.peterson, gombiuda
消息: + msg102815
components: + Installation, - 2to3 (2.x to 3.x conversion tool)
2010-04-11 04:29:18gombiuda修改文件: + py2_test_grammar.patch

抄送: + gombiuda
消息: + msg102809

keywords: + patch
2010-03-27 01:06:06benjamin.peterson修改assignee: benjamin.peterson -> loewis

消息: + msg101814
抄送: + loewis
2010-03-27 00:50:53ezio.melotti修改优先级: normal
assignee: benjamin.peterson

抄送: + benjamin.peterson
stage: needs patch
2010-03-27 00:48:59ggenellina创建