test_module_with_large_stack(): This failed when Python was run with -O,

trying to delete a .pyc file that didn't exist (it needed to delete .pyo
then).
This commit is contained in:
Tim Peters 2002-06-15 05:14:05 +00:00
parent 06727123db
commit 0f1afb1df3
1 changed files with 5 additions and 2 deletions

View File

@ -88,7 +88,7 @@ def test_module_with_large_stack(module):
f.write(']') f.write(']')
f.close() f.close()
# compile & remove .py file, we only need .pyc # compile & remove .py file, we only need .pyc (or .pyo)
f = open(filename, 'r') f = open(filename, 'r')
py_compile.compile(filename) py_compile.compile(filename)
f.close() f.close()
@ -102,6 +102,9 @@ def test_module_with_large_stack(module):
# cleanup # cleanup
del sys.path[-1] del sys.path[-1]
os.unlink(module + '.pyc') for ext in '.pyc', '.pyo':
fname = module + ext
if os.path.exists(fname):
os.unlink(fname)
test_module_with_large_stack('longlist') test_module_with_large_stack('longlist')