Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3090694

Browse files
committed
Fix compileall.py so that it fails on SyntaxErrors
The changes cause compilation failures in any file in the Python installation lib directory to cause the install to fail. It looks like compileall.py intended to behave this way, but a change to py_compile.py and a separate bug defeated it. Fixes SF bug #412436 This change affects the test suite, which contains several files that contain intentional errors. The solution is to extend compileall.py with the ability to skip compilation of selected files. In the test suite, rename nocaret.py and test_future[3..7].py to start with badsyntax_nocaret.py and badsyntax_future[3..7].py. Update the makefile to skip compilation of these files. Update the tests to use the name names for imports. NB compileall.py is changed so that compile_dir() returns success only if all recursive calls to compile_dir() also check success.
1 parent bc41957 commit 3090694

10 files changed

Lines changed: 11 additions & 16 deletions

Lib/test/output/test_future

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
test_future
22
6
33
6
4-
SyntaxError test_future3 3
5-
SyntaxError test_future4 3
6-
SyntaxError test_future5 4
7-
SyntaxError test_future6 3
8-
SyntaxError test_future7 3
4+
SyntaxError badsyntax_future3 3
5+
SyntaxError badsyntax_future4 3
6+
SyntaxError badsyntax_future5 4
7+
SyntaxError badsyntax_future6 3
8+
SyntaxError badsyntax_future7 3

Lib/test/regrtest.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,6 @@ def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0,
199199
'test_b2',
200200
'test_future1',
201201
'test_future2',
202-
'test_future3',
203-
'test_future4',
204-
'test_future5',
205-
'test_future6',
206-
'test_future7',
207202
]
208203

209204
def findtests(testdir=None, stdtests=STDTESTS, nottests=NOTTESTS):

Lib/test/test_future.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,26 @@ def check_error_location(msg):
1919

2020
# The remaining tests should fail
2121
try:
22-
import test_future3
22+
import badsyntax_future3
2323
except SyntaxError, msg:
2424
check_error_location(str(msg))
2525

2626
try:
27-
import test_future4
27+
import badsyntax_future4
2828
except SyntaxError, msg:
2929
check_error_location(str(msg))
3030

3131
try:
32-
import test_future5
32+
import badsyntax_future5
3333
except SyntaxError, msg:
3434
check_error_location(str(msg))
3535

3636
try:
37-
import test_future6
37+
import badsyntax_future6
3838
except SyntaxError, msg:
3939
check_error_location(str(msg))
4040

4141
try:
42-
import test_future7
42+
import badsyntax_future7
4343
except SyntaxError, msg:
4444
check_error_location(str(msg))

Lib/test/test_traceback.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def syntax_error_with_caret(self):
2222

2323
def syntax_error_without_caret(self):
2424
# XXX why doesn't compile raise the same traceback?
25-
import nocaret
25+
import badsyntax_nocaret
2626

2727
def test_caret(self):
2828
err = self.get_exception_format(self.syntax_error_with_caret,

0 commit comments

Comments
 (0)